/**
 * TelNova PMS - Premium Glass Theme v1.2
 * AGGRESSIVE OVERRIDES for Frappe v15
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    --tn-primary: #0ea5e9 !important;
    --tn-primary-dark: #0284c7 !important;
    --tn-secondary: #10b981 !important;
}

/* BODY BACKGROUND */
body, html {
    background: linear-gradient(135deg, #ecfeff 0%, #e0f2fe 30%, #f0fdf4 70%, #ecfeff 100%) !important;
    background-attachment: fixed !important;
}

/* FORCE NAVBAR TO GLASS */
.navbar, 
nav.navbar,
header.navbar,
.frappe-control .navbar,
#navbar,
[data-page-container] .navbar,
body > header,
body > nav {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(14, 165, 233, 0.15) !important;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05) !important;
}

/* Navbar items */
.navbar .nav-link,
.navbar-nav .nav-link,
.navbar a {
    color: #334155 !important;
}

.navbar-brand, .navbar .navbar-brand {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 800 !important;
    font-size: 20px !important;
    background: linear-gradient(135deg, #0ea5e9, #10b981) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* SEARCH BAR */
.search-bar, 
.search-bar input,
[data-doctype="Search"],
input[data-doctype="Search"],
.awesomebar,
#navbar-search,
#navbar-search input {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 25px !important;
    color: #334155 !important;
}

/* SIDEBAR GLASS */
.desk-sidebar,
.layout-side-section,
aside.desk-sidebar,
[data-page-container] aside,
.col-lg-2.layout-side-section {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-right: 1px solid rgba(14, 165, 233, 0.1) !important;
}

/* Sidebar items */
.desk-sidebar .desk-sidebar-item.active a,
.desk-sidebar .desk-sidebar-item a.active,
.sidebar-menu .active,
.desk-sidebar-item.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(16, 185, 129, 0.15)) !important;
    border-radius: 10px !important;
    border-left: 4px solid #0ea5e9 !important;
    font-weight: 600 !important;
}

.desk-sidebar .desk-sidebar-item a:hover,
.sidebar-menu a:hover {
    background: rgba(14, 165, 233, 0.1) !important;
    border-radius: 8px !important;
}

/* ALL CARDS & PANELS */
.frappe-card,
.form-section,
.section-body,
.widget,
.widget-group,
.onboarding-widget-box,
.shortcut-widget-box,
.links-widget-box,
.number-widget-box,
.frappe-list .result,
.page-container .page-body,
.form-document,
.form-page,
[data-page-container] .layout-main-section,
.layout-main-section-wrapper,
.main-section,
div[data-page-container="true"] .layout-main-section {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(14, 165, 233, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* Card hover */
.frappe-card:hover,
.widget:hover,
.shortcut-widget-box:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 40px rgba(14, 165, 233, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06) !important;
    border-color: rgba(14, 165, 233, 0.25) !important;
}

/* PRIMARY BUTTONS - GRADIENT */
.btn-primary,
.btn-primary-dark,
.btn-primary-light,
.page-actions .primary-action,
.primary-action,
button.btn-primary,
a.btn-primary,
.btn.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4), 0 2px 4px rgba(14, 165, 233, 0.2) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.25s ease !important;
    padding: 8px 20px !important;
}

.btn-primary:hover,
.btn-primary-dark:hover,
button.btn-primary:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5), 0 4px 8px rgba(14, 165, 233, 0.25) !important;
}

/* SECONDARY BUTTONS */
.btn-default,
.btn-secondary,
.btn-light,
button.btn-default,
button.btn-secondary {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    color: #475569 !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.2s ease !important;
}

.btn-default:hover,
.btn-secondary:hover {
    background: #ffffff !important;
    border-color: #0ea5e9 !important;
    color: #0ea5e9 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15) !important;
}

/* SUCCESS BUTTON */
.btn-success, button.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
}

/* DANGER BUTTON */
.btn-danger, button.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4) !important;
}

/* FORM INPUTS */
.form-control,
input.form-control,
select.form-control,
textarea.form-control,
.frappe-control input,
.frappe-control select,
.frappe-control textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input.input-with-feedback {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    transition: all 0.2s ease !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}

.form-control:focus,
input.form-control:focus,
.frappe-control input:focus {
    border-color: #0ea5e9 !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}

/* PAGE TITLES */
.page-title,
h1.page-title,
.page-head .page-title,
.title-text {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 28px !important;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* SECTION HEADERS */
.section-head,
.form-section .section-head,
.head-title {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    color: #334155 !important;
    padding-bottom: 12px !important;
    margin-bottom: 16px !important;
    border-bottom: 2px solid rgba(14, 165, 233, 0.2) !important;
}

/* LIST ROWS */
.frappe-list .list-row,
.list-row-container .list-row,
.list-item {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 12px !important;
    margin-bottom: 8px !important;
    padding: 14px 18px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    transition: all 0.2s ease !important;
}

.frappe-list .list-row:hover,
.list-row:hover {
    transform: translateX(6px) !important;
    background: rgba(14, 165, 233, 0.06) !important;
    border-color: rgba(14, 165, 233, 0.2) !important;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.1) !important;
}

/* MODALS */
.modal-content {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

.modal-header {
    background: rgba(248, 250, 252, 0.8) !important;
    border-bottom: 1px solid rgba(14, 165, 233, 0.1) !important;
    padding: 20px 24px !important;
}

.modal-title {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    color: #1e293b !important;
}

.modal-backdrop, .modal-backdrop.show {
    background: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(4px) !important;
}

/* BADGES */
.badge, .indicator-pill {
    font-weight: 600 !important;
    font-size: 11px !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.indicator-pill.green, .badge-success {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
    color: white !important;
}

.indicator-pill.blue, .badge-info {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9) !important;
    color: white !important;
}

.indicator-pill.red, .badge-danger {
    background: linear-gradient(135deg, #f87171, #ef4444) !important;
    color: white !important;
}

.indicator-pill.orange, .indicator-pill.yellow, .badge-warning {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: #1e293b !important;
}

/* DROPDOWN */
.dropdown-menu {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
    padding: 8px !important;
}

.dropdown-item {
    border-radius: 8px !important;
    padding: 10px 16px !important;
    color: #475569 !important;
    transition: all 0.15s ease !important;
}

.dropdown-item:hover {
    background: rgba(14, 165, 233, 0.1) !important;
    color: #0284c7 !important;
}

/* ALERTS */
.alert {
    border-radius: 12px !important;
    border: none !important;
    border-left: 4px solid !important;
    backdrop-filter: blur(10px) !important;
}

.alert-info { background: rgba(14, 165, 233, 0.1) !important; border-left-color: #0ea5e9 !important; }
.alert-success { background: rgba(16, 185, 129, 0.1) !important; border-left-color: #10b981 !important; }
.alert-warning { background: rgba(245, 158, 11, 0.1) !important; border-left-color: #f59e0b !important; }
.alert-danger { background: rgba(239, 68, 68, 0.1) !important; border-left-color: #ef4444 !important; }

/* PROGRESS */
.progress {
    height: 8px !important;
    border-radius: 10px !important;
    background: #e2e8f0 !important;
}

.progress-bar {
    background: linear-gradient(90deg, #0ea5e9, #10b981) !important;
    border-radius: 10px !important;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px !important; height: 8px !important; }
::-webkit-scrollbar-track { background: transparent !important; }
::-webkit-scrollbar-thumb { background: #cbd5e1 !important; border-radius: 10px !important; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8 !important; }

/* LINKS */
a { color: #0ea5e9 !important; }
a:hover { color: #0284c7 !important; }

/* ICONS IN SIDEBAR */
.desk-sidebar .icon, .sidebar-menu .icon {
    color: #64748b !important;
}

.desk-sidebar-item.active .icon {
    color: #0ea5e9 !important;
}

/* Fix white text on dark backgrounds */
.dark, [data-theme="dark"] {
    --tn-primary: #38bdf8 !important;
}

/* Print */
@media print {
    body { background: white !important; }
    .frappe-card, .modal-content { backdrop-filter: none !important; box-shadow: none !important; }
}

/* Modal Error Text Contrast Fix */
.modal-body, .modal-content, .msgprint {
    color: #1f2937 !important;
}

.modal-title {
    color: #111827 !important;
    font-weight: 600 !important;
}

.alert-danger, .text-danger {
    color: #ffffff !important;
    background: #ef4444 !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
}

/* ========================================
   CRITICAL: Modal & Error Text Contrast
======================================== */
.modal-body,
.modal-content,
.modal-body p,
.modal-body div,
.modal-body span,
.msgprint,
.msgprint p,
.msgprint div {
    color: #111827 !important;
    font-weight: 500 !important;
}

.modal-title {
    color: #000000 !important;
    font-weight: 700 !important;
}

.modal-header .indicator {
    background: #ef4444 !important;
}

/* Error message styling */
.msgprint {
    background: #fef2f2 !important;
    border: 2px solid #ef4444 !important;
    color: #991b1b !important;
}

.modal-body .text-muted {
    color: #4b5563 !important;
}
