@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --font-primary: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    
    /* Elegant trust-oriented slate color palette */
    --bg-app: radial-gradient(circle at 10% 20%, rgb(245, 247, 250) 0%, rgb(233, 238, 246) 90.1%);
    --bg-card: rgba(255, 255, 255, 0.96);
    --bg-card-solid: #ffffff;
    --bg-light: #f8fafc;
    
    --text-primary: #0f172a;    /* slate 900 */
    --text-secondary: #334155;  /* slate 700 */
    --text-muted: #64748b;      /* slate 500 */
    
    --border-color: rgba(226, 232, 240, 0.9);      /* slate 200/300 */
    --border-color-hover: rgba(148, 163, 184, 0.8);/* slate 400 */
    
    /* Unified Semantic Status Tokens */
    --status-success: #059669;
    --status-success-bg: #ecfdf5;
    --status-success-border: #a7f3d0;
    --status-success-text: #065f46;

    --status-info: #2563eb;
    --status-info-bg: #eff6ff;
    --status-info-border: #bfdbfe;
    --status-info-text: #1e40af;

    --status-warning: #d97706;
    --status-warning-bg: #fef3c7;
    --status-warning-border: #fde68a;
    --status-warning-text: #92400e;

    --status-danger: #dc2626;
    --status-danger-bg: #fef2f2;
    --status-danger-border: #fecaca;
    --status-danger-text: #991b1b;

    /* Backward compatibility aliases */
    --color-secure: var(--status-success);
    --color-secure-bg: var(--status-success-bg);
    --color-secure-border: var(--status-success-border);
    --color-warn: var(--status-warning);
    --color-warn-bg: var(--status-warning-bg);
    --color-warn-border: var(--status-warning-border);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 20px -3px rgba(15, 23, 42, 0.07), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 20px 40px -15px rgba(15, 23, 42, 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.06);
    
    /* Radii */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

html {
    font-size: 15px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    background-image: 
        radial-gradient(rgba(37, 99, 235, 0.04) 1.5px, transparent 1.5px),
        radial-gradient(rgba(37, 99, 235, 0.04) 1.5px, transparent 1.5px),
        var(--bg-app);
    background-size: 32px 32px, 32px 32px, 100% 100%;
    background-position: 0 0, 16px 16px, 0 0;
    background-repeat: repeat, repeat, no-repeat;
    background-attachment: scroll, scroll, fixed;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    margin: 0;
    margin-bottom: 75px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Glassmorphism card utility */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass), var(--shadow-lg);
    padding: 2.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-glass), 0 25px 50px -12px rgba(15, 23, 42, 0.08);
}

/* Premium buttons */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    border-radius: var(--tenant-button-radius, var(--radius-full));
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    outline: none;
}

.btn-modern-primary {
    color: white !important;
    background: var(--tenant-primary, #2563eb);
    box-shadow: 0 4px 14px var(--tenant-primary-glow, rgba(37, 99, 235, 0.25));
}

.btn-modern-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 6px 20px var(--tenant-primary-glow, rgba(37, 99, 235, 0.35));
    color: white !important;
}

.btn-modern-primary:active {
    transform: translateY(0);
}

.btn-modern-secondary {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-sm);
}

.btn-modern-secondary:hover {
    background: var(--bg-light);
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary) !important;
}

/* Elegant input fields */
.form-input-modern {
    width: 100%;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card-solid);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.98rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input-modern::placeholder {
    color: var(--text-muted);
}

.form-input-modern:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--tenant-primary, #2563eb);
    box-shadow: 0 0 0 3.5px var(--tenant-primary-glow, rgba(37, 99, 235, 0.15));
}

/* Form Groups & Labels */
.form-group-custom {
    margin-bottom: 1.35rem;
    text-align: left;
}

.form-label-custom {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.45rem;
    letter-spacing: -0.01em;
}

.form-helper-text {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Select element overrides */
select.form-input-modern {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.15rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-slide-up {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-in {
    animation: fadeIn 0.35s ease-out forwards;
}

/* Alerts */
.alert-modern {
    padding: 0.95rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.35rem;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-modern-danger {
    background-color: var(--status-danger-bg);
    color: var(--status-danger-text);
    border-color: var(--status-danger-border);
}

.alert-modern-info {
    background-color: var(--status-info-bg);
    color: var(--status-info-text);
    border-color: var(--status-info-border);
}

.alert-modern-success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
    border-color: var(--status-success-border);
}

.alert-modern-warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
    border-color: var(--status-warning-border);
}

/* Admin Login Screen Styles */
.admin-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 3.5rem auto 5rem;
    width: 100%;
    padding: 0 1rem;
}

.admin-login-card {
    width: 100%;
    max-width: 440px;
    position: relative;
    overflow: hidden;
    padding: 3rem 2.25rem 2.25rem !important;
    text-align: center;
}

.admin-login-card .login-lock-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.admin-login-card .login-lock-badge svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-login-card h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    margin: 0 0 0.4rem 0;
}

.admin-login-card .login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1.75rem 0;
    font-weight: 500;
    line-height: 1.5;
}

.admin-login-card .form-group-modern {
    margin-bottom: 1.15rem;
    text-align: left;
}

.admin-login-card .login-footer-text {
    margin-top: 1.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    margin-bottom: 0;
}

/* Security Status Badges & Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card-solid);
    color: var(--text-secondary);
}

.status-pill-secure {
    background: var(--color-secure-bg);
    color: var(--color-secure);
    border-color: var(--color-secure-border);
}

.status-pill-blue {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

/* Attachment Cards */
.attachment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 1rem;
}

.attachment-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.file-type-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.file-badge-pdf { background: #fee2e2; color: #b91c1c; }
.file-badge-zip { background: #fef3c7; color: #b45309; }
.file-badge-doc { background: #dbeafe; color: #1d4ed8; }
.file-badge-img { background: #dcfce7; color: #15803d; }
.file-badge-generic { background: #f1f5f9; color: #475569; }

.attachment-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.attachment-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.attachment-download-btn {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tenant-primary, #2563eb);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* Dark Mode Palette Overrides */
[data-theme="dark"] {
    --bg-app: radial-gradient(circle at 10% 20%, rgb(15, 23, 42) 0%, rgb(10, 15, 30) 90.1%);
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-card-solid: #1e293b;
    --bg-light: #0f172a;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: rgba(51, 65, 85, 0.8);
    --border-color-hover: rgba(71, 85, 105, 0.9);

    /* Dark Mode Semantic Status Tokens */
    --status-success: #34d399;
    --status-success-bg: rgba(6, 95, 70, 0.25);
    --status-success-border: rgba(16, 185, 129, 0.35);
    --status-success-text: #6ee7b7;

    --status-info: #60a5fa;
    --status-info-bg: rgba(30, 58, 138, 0.25);
    --status-info-border: rgba(59, 130, 246, 0.35);
    --status-info-text: #93c5fd;

    --status-warning: #fbbf24;
    --status-warning-bg: rgba(146, 64, 14, 0.25);
    --status-warning-border: rgba(245, 158, 11, 0.35);
    --status-warning-text: #fde68a;

    --status-danger: #f87171;
    --status-danger-bg: rgba(127, 29, 29, 0.25);
    --status-danger-border: rgba(239, 68, 68, 0.35);
    --status-danger-text: #fca5a5;
}

[data-theme="dark"] body {
    background-image: 
        radial-gradient(rgba(59, 130, 246, 0.08) 1.5px, transparent 1.5px),
        radial-gradient(rgba(59, 130, 246, 0.08) 1.5px, transparent 1.5px),
        var(--bg-app);
}

[data-theme="dark"] .navbar-custom {
    background: rgba(15, 23, 42, 0.85) !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.8) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="dark"] .navbar-brand-custom {
    color: #f8fafc !important;
}

[data-theme="dark"] .nav-link-custom {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .nav-link-custom:hover {
    color: #f8fafc !important;
    background: rgba(51, 65, 85, 0.8) !important;
}

[data-theme="dark"] .footer-custom {
    background: rgba(15, 23, 42, 0.85) !important;
    border-top: 1px solid rgba(51, 65, 85, 0.8) !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .footer-custom a {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .footer-custom a:hover {
    color: #f8fafc !important;
}

[data-theme="dark"] .itc-brand-url {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .itc-brand-url:hover {
    color: #3b82f6 !important;
}

[data-theme="dark"] .glass-card {
    background: var(--bg-card);
}

[data-theme="dark"] .btn-modern-secondary {
    background: rgba(30, 41, 59, 0.8);
    color: #f8fafc !important;
    border-color: rgba(51, 65, 85, 0.8);
}

[data-theme="dark"] .btn-modern-secondary:hover {
    background: #1e293b;
    border-color: rgba(71, 85, 105, 0.9);
}

[data-theme="dark"] .form-input-modern {
    background: rgba(15, 23, 42, 0.6);
    color: #f8fafc;
    border-color: rgba(51, 65, 85, 0.8);
}

[data-theme="dark"] .form-input-modern:focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--tenant-primary, #3b82f6);
    box-shadow: 0 0 0 3.5px var(--tenant-primary-glow, rgba(59, 130, 246, 0.15));
}

[data-theme="dark"] .form-input-modern::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .alert-modern-danger {
    background-color: rgba(127, 29, 29, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .alert-modern-info {
    background-color: rgba(30, 58, 138, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .alert-modern-success {
    background-color: rgba(6, 95, 70, 0.2);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .disclaimer-text-box {
    background: rgba(15, 23, 42, 0.4) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .attachment-card {
    background: var(--bg-card-solid);
    border-color: var(--border-color);
}

[data-theme="dark"] .file-badge-generic {
    background: rgba(51, 65, 85, 0.5);
    color: #cbd5e1;
}

/* Theme Toggle Icons */
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: none; }

/* Quill Editor Dark Mode */
[data-theme="dark"] .ql-toolbar.ql-snow {
    background: var(--bg-light) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .ql-container.ql-snow {
    background: var(--bg-card-solid) !important;
    border-color: var(--border-color) !important;
}
.ql-editor {
    color: var(--text-primary);
}
.ql-bubble .ql-editor {
    color: var(--text-primary);
}
.ql-snow .ql-editor {
    color: var(--text-primary);
}
.ql-blank::before {
    color: var(--text-muted) !important;
}
[data-theme="dark"] .ql-snow .ql-stroke {
    stroke: var(--text-primary) !important;
}
[data-theme="dark"] .ql-snow .ql-fill {
    fill: var(--text-primary) !important;
}
[data-theme="dark"] .ql-snow .ql-picker {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .ql-snow .ql-picker-options {
    background-color: var(--bg-card-solid) !important;
    border-color: var(--border-color) !important;
}