/* =============================================
   إدارة الاحتياط والمناوبة - تصميم متطور
   Substitution Hub - Premium Redesign
   ============================================= */

/* ─── Page Background ─── */
#page-substitution {
    background: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 50%, #eff6ff 100%);
    min-height: 100vh;
    padding: 10px 20px;
}

/* ─── Main Container ─── */
.substitution-hub-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
}
#sub-hub-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sub-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sub-tab-content.hidden {
    display: none !important;
}

/* =============================================
   HEADER DASHBOARD CARD
   ============================================= */
.sub-hub-header {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    gap: 0;
    align-items: stretch;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 45%, #0284c7 100%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(2, 132, 199, 0.25), 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    position: relative;
}

/* Decorative glow orbs */
.sub-hub-header::before {
    content: '';
    position: absolute;
    top: -40px;
    left: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.sub-hub-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: 20%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ─── Left: Circular Progress ─── */
.sub-completion-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px 24px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.circular-progress-sub {
    position: relative;
    width: 95px;
    height: 95px;
    flex-shrink: 0;
}

.circular-progress-sub svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
    overflow: visible; /* Prevents clipping or bounding boxes occasionally */
}

.circular-progress-sub .progress-bg {
    fill: none;
    stroke: rgba(255,255,255,0.15);
    stroke-width: 3.5;
}

.circular-progress-sub .progress-bar {
    fill: none;
    stroke: #60a5fa;
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.8s ease;
}

.progress-text-sub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.35rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
}

.updating-pulse {
    animation: sub-pulse 0.6s ease-out;
    stroke-width: 5 !important;
}

.updating-text {
    transform: translate(-50%, -50%) scale(1.2);
    color: #bfdbfe;
}

@keyframes sub-pulse {
    0%   { stroke-width: 3.5; opacity: 1; }
    50%  { stroke-width: 7;   opacity: 0.7; }
    100% { stroke-width: 3.5; opacity: 1; }
}

.progress-desc {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-desc .main-val {
    font-size: 1.1rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
}

.progress-desc .sub-val {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    line-height: 1.4;
}

/* ─── Center: Deficit Bar ─── */
.deficit-bar-center {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    flex: 1;
}

.deficit-bar-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.deficit-bar-title i {
    color: #fbbf24;
    font-size: 0.9rem;
    animation: warningPulse 2s infinite;
}

@keyframes warningPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(1.15); }
}

.deficit-capsules-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 40px;
    align-items: center;
}

/* Capsule animations */
.deficit-capsule {
    padding: 7px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: capsuleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes capsuleIn {
    from { opacity: 0; transform: scale(0.7) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.deficit-capsule.absent {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.deficit-capsule.absent:hover {
    background: rgba(239, 68, 68, 0.35);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.deficit-capsule.covered {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.deficit-capsule.covered:hover {
    background: rgba(16, 185, 129, 0.35);
    transform: translateY(-2px) scale(1.05);
}

/* Additions for capsule features (Badge & CloseBtn) */
.deficit-badge-count {
    position: absolute;
    top: -8px;
    right: -8px; /* Assuming RTL pushes it to top right of capsule */
    background: #f59e0b;
    color: white;
    font-size: 0.7rem;
    font-weight: 900;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 2;
    transition: all 0.3s;
}

.deficit-capsule.absent .deficit-badge-count {
    background: #ef4444;
    border-color: #fef2f2;
}

.deficit-capsule.covered .deficit-badge-count {
    background: #94a3b8; /* Gray for inactive/completed */
    border-color: #cbd5e1;
    color: white;
    opacity: 0.85;
}

.deficit-cancel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.5;
    padding: 4px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.85rem;
    margin-right: 4px; /* Space between name and X */
}

.deficit-cancel-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.1);
    transform: scale(1.2) rotate(90deg);
}

.deficit-capsule.absent .deficit-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.deficit-capsule.covered .deficit-cancel-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* Empty state inside deficit bar */
.deficit-capsules-container .text-light {
    color: rgba(255,255,255,0.4) !important;
    font-size: 0.78rem;
}

/* ─── Right: Step Badges ─── */
.sub-steps-badges {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 28px 24px;
    border-right: 1px solid rgba(255,255,255,0.12);
}

.sub-step-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 14px;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.07);
    transition: all 0.3s;
}

.sub-step-badge.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sub-step-badge.done {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.sub-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 900;
    flex-shrink: 0;
    transition: all 0.3s;
}

.sub-step-badge.active .sub-step-icon {
    background: #60a5fa;
    color: #1e3a8a;
    box-shadow: 0 0 12px rgba(96,165,250,0.5);
}

.sub-step-badge.done .sub-step-icon {
    background: #10b981;
    color: white;
}

/* =============================================
   NAVIGATION TABS
   ============================================= */
.sub-nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px;
    border-radius: 20px;
    gap: 8px;
    width: fit-content;
    margin: 0 auto;
    box-shadow: 0 4px 25px rgba(37,99,235,0.08), 0 1px 4px rgba(0,0,0,0.04), inset 0 0 0 1px rgba(255,255,255,0.6);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.sub-nav-tab {
    padding: 10px 26px 10px 20px;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 800;
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    /* Default: زر 1 أزرق، زر 2 بنفسجي */
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.85) 0%, rgba(29, 78, 216, 0.9) 100%);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.2);
}

/* زر 1 (غرفة العمليات) — لون أزرق دائماً */
.sub-nav-tab:nth-child(1) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 15px rgba(37,99,235,0.3);
}

.sub-nav-tab:nth-child(1):hover:not(.active) {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 6px 20px rgba(37,99,235,0.45);
    transform: translateY(-1px);
}

/* زر 2 (لوحة المناوبة) — لون بنفسجي دائماً */
.sub-nav-tab:nth-child(2) {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    box-shadow: 0 4px 15px rgba(139,92,246,0.3);
}

.sub-nav-tab:nth-child(2):hover:not(.active) {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    box-shadow: 0 6px 20px rgba(139,92,246,0.45);
    transform: translateY(-1px);
}

/* الزر النشط — أبيض مع نص رمادي (يدل على الصفحة الحالية) */
.sub-nav-tab.active {
    background: #ffffff !important;
    color: #94a3b8 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1), inset 0 1px 3px rgba(0,0,0,0.05) !important;
    border: 1px solid #e2e8f0 !important;
    transform: translateY(0) !important;
}

/* أيقونة الزر — دائماً بيضاء على الخلفية الملونة */
.sub-nav-tab i {
    font-size: 1.05rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-nav-tab i::before {
    -webkit-text-fill-color: #ffffff;
    transition: all 0.3s ease;
}

.sub-nav-tab:hover:not(.active) i {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* أيقونة الزر النشط — رمادية على خلفية بيضاء */
.sub-nav-tab.active i {
    background: rgba(100, 116, 139, 0.1) !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(1) !important;
}

.sub-nav-tab.active i::before {
    -webkit-text-fill-color: #94a3b8 !important;
    filter: none !important;
}

/* =============================================
   INPUT SIDEBAR CARD
   ============================================= */
.sub-controls-card {
    background: white !important;
    border-radius: 22px !important;
    padding: 28px !important;
    box-shadow: 0 8px 32px rgba(37,99,235,0.08), 0 1px 4px rgba(0,0,0,0.04) !important;
    border: 1px solid rgba(37,99,235,0.08) !important;
    position: sticky !important;
    top: 20px !important;
}

/* Override inline style for sub-controls-card */
div.sub-controls-card[style] {
    background: white !important;
    box-shadow: 0 8px 32px rgba(37,99,235,0.08), 0 1px 4px rgba(0,0,0,0.04) !important;
}

/* Section header inside the card */
.sub-controls-card h4.section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.sub-controls-card h4.section-label i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Form Labels */
.sub-select-wrap label {
    font-size: 0.77rem !important;
    font-weight: 800 !important;
    color: #475569 !important;
    margin-bottom: 7px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

/* Enhanced Selects & Inputs (3D Glassy Effect) */
.sub-controls-card select.form-control,
.sub-controls-card input[type="date"].form-control {
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 12px !important;
    padding: 11px 16px !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.85)) !important;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.03), 
                -4px -4px 10px rgba(255, 255, 255, 1),
                inset 1px 1px 2px rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    width: 100% !important;
    cursor: pointer !important;
    appearance: none; /* Hide default dropdown arrow in some browsers to style cleanly */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: left 12px center !important; /* Adjust for RTL */
    background-size: 16px !important;
}
/* Ensure date input drops arrow if present */
.sub-controls-card input[type="date"].form-control {
    background-image: none !important;
}

.sub-controls-card select.form-control:hover,
.sub-controls-card input[type="date"].form-control:hover {
    background: linear-gradient(145deg, #ffffff, #f1f5f9) !important;
    transform: translateY(-2px) !important;
    box-shadow: 6px 6px 14px rgba(0, 0, 0, 0.05), 
                -6px -6px 14px rgba(255, 255, 255, 1),
                inset 1px 1px 2px rgba(255, 255, 255, 0.9) !important;
}

.sub-controls-card select.form-control:focus,
.sub-controls-card input[type="date"].form-control:focus {
    border-color: #3b82f6 !important;
    background: white !important;
    box-shadow: inset 3px 3px 6px rgba(0,0,0,0.03), 
                inset -3px -3px 6px rgba(255,255,255,1), 
                0 0 0 4px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
    transform: translateY(0) !important; /* Pressed in effect */
}

/* Main Action Button (Matching the premium attached image style) */
.sub-controls-card .royal-action-btn {
    width: 100%;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 40%, #2563eb 100%) !important;
    border-radius: 50px !important; /* Capsule / Pill shape */
    padding: 14px 24px !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2), 0 4px 10px rgba(37, 99, 235, 0.15) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    position: relative;
    overflow: hidden;
}

.sub-controls-card .royal-action-btn:hover {
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.25), 0 6px 15px rgba(37, 99, 235, 0.25) !important;
    filter: brightness(1.1) !important;
}

.sub-controls-card .royal-action-btn:active {
    transform: scale(0.96) translateY(0) !important;
}

/* Style for the icon inside the button to look like the circle in the image */
.sub-controls-card .royal-action-btn i {
    background: rgba(255, 255, 255, 0.2);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
    margin-left: 12px;
    transition: all 0.3s ease;
}

.sub-controls-card .royal-action-btn:hover i {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(15deg);
}

/* Absence Warning */
#absence-history-warning {
    border-radius: 12px !important;
    border-right: 4px solid !important;
    padding: 12px 14px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    animation: fadeIn 0.3s ease;
    line-height: 1.5 !important;
}

/* =============================================
   RESULTS RIGHT PANEL
   ============================================= */
.sub-results-card {
    background: white;
    border-radius: 22px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.04), 0 1px 4px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
    overflow: hidden;
}

/* ─── Candidate Cards ─── */
.sub-candidate-card-modern {
    background: white;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
    border: 2px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-candidate-card-modern:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 24px rgba(37,99,235,0.1);
    transform: translateX(-4px);
}

.candidate-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #2563eb;
    border: 2px solid #bfdbfe;
}

.cand-name {
    font-size: 1rem;
    font-weight: 900;
    color: #0f172a;
}

.cand-details {
    display: flex;
    gap: 14px;
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 4px;
}

.cand-details span i {
    color: #93c5fd;
    margin-left: 4px;
}

/* Fairness Badges */
.fairness-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid;
}

.fairness-badge.low {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.fairness-badge.med {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

.fairness-badge.high {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Assign Button */
.assign-btn-royal {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
    white-space: nowrap;
}

.assign-btn-royal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16,185,129,0.45);
}

/* =============================================
   DAILY LOG SIDEBAR SECTION
   ============================================= */
#daily-sub-log-container {
    margin-top: 22px;
    border-top: 2px dashed #e2e8f0;
    padding-top: 18px;
}

.sub-log-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.sub-log-item:hover {
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.08);
}

/* =============================================
   NAVIGATION TABS (Week Days for Duty Board)
   ============================================= */
.duty-day-tab {
    padding: 9px 18px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
}

.duty-day-tab.active,
.duty-day-tab:hover {
    background: white;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,0.15);
}

.duty-day-tab.duty-fri-tab.active {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.duty-day-tab.duty-fri-tab:hover:not(.active) {
    background: #ecfdf5;
    color: #059669;
}

/* =============================================
   DUTY BOARD CARDS
   ============================================= */
.duty-board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.duty-card-modern {
    background: white;
    border-radius: 20px;
    padding: 22px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.duty-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #2563eb, #7c3aed);
    border-radius: 0 20px 20px 0;
    transition: width 0.3s;
}

.duty-card-modern:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(37,99,235,0.12);
    border-color: #bfdbfe;
}

.duty-card-modern:hover::before {
    width: 6px;
}

.duty-teacher-zone {
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 14px;
    border: 2px dashed #cbd5e1;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.duty-teacher-zone:hover {
    border-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

/* =============================================
   TRANSITION ANIMATIONS
   ============================================= */
.transition-page {
    animation: slideUpIn 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes slideUpIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* =============================================
   SMART ADVICE TIP
   ============================================= */
.smart-advice-tip {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: 14px;
    margin-top: 20px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #92400e;
    font-size: 0.86rem;
    font-weight: 600;
}

.smart-advice-tip i {
    font-size: 1.3rem;
    color: #f59e0b;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
    animation: fadeIn 0.4s ease;
}

.empty-state i {
    display: block;
    margin-bottom: 16px;
}

/* =============================================
   PRINT OVERRIDES
   ============================================= */
@media print {
    .hide-on-print { display: none !important; }
    .page-section  { display: block !important; background: white !important; }
    .sub-hub-header { display: none !important; }
    .sub-nav-tabs  { display: none !important; }
    #page-substitution { background: white !important; padding: 0 !important; }
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
    .sub-hub-header {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .sub-completion-stats,
    .sub-steps-badges {
        border: none;
        border-top: 1px solid rgba(255,255,255,0.12);
    }
}

@media (max-width: 768px) {
    #page-substitution { padding: 12px; }
    .sub-hub-header { border-radius: 18px; }
    .sub-nav-tab { padding: 10px 16px; font-size: 0.82rem; }
}

/* =============================================
   SUBSTITUTION PERIOD NAVIGATION
   ============================================= */
.sub-periods-nav {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.sub-period-box {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15); /* Soft base */
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: #f8fafc;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    user-select: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sub-period-box:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-4px) scale(1.08);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2), 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Pastel Active State - Soft Lavender/Blue */
.sub-period-box.active {
    background: linear-gradient(135deg, #e0e7ff, #f5f3ff) !important; /* Pastel Lavender */
    color: #4338ca !important;
    transform: scale(1.2);
    box-shadow: 0 12px 30px rgba(67, 56, 202, 0.25), 
                0 0 20px rgba(224, 231, 255, 0.8);
    border-color: #ffffff !important;
    animation: pastel-pulse 2.5s infinite ease-in-out;
}

@keyframes pastel-pulse {
    0% { box-shadow: 0 0 15px rgba(224,231,255,0.4), 0 0 25px rgba(255,255,255,0.3); }
    50% { box-shadow: 0 0 30px rgba(224,231,255,0.7), 0 0 40px rgba(255,255,255,0.5); }
    100% { box-shadow: 0 0 15px rgba(224,231,255,0.4), 0 0 25px rgba(255,255,255,0.3); }
}

/* Pastel Completed State - Soft Mint */
.sub-period-box.completed {
    background: linear-gradient(135deg, #dcfce7, #f0fdf4) !important; /* Pastel Mint */
    border-color: #86efac !important;
    color: #15803d !important;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.sub-period-box.completed:hover {
    background: #bbf7d0 !important;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

.sub-period-box.completed::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.55rem;
    position: absolute;
    top: -5px;
    right: -5px;
    background: #10b981;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- Notification Center Redesign --- */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeInModal 0.3s ease-out;
}

.custom-modal-overlay .modal-content {
    background: white;
    width: 90%;
    max-width: 480px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 0;
    overflow: hidden;
    animation: slideUpModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.notification-center-popup {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.note-center-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #1e3a8a, #1e40af);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    gap: 15px; /* Added gap between items */
}

.note-center-header h3 {
    margin: 0;
    margin-right: 65px; /* Increased from 55px to ensure no overlap with X button on the right */
    margin-left: 10px;  
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 1; /* Allow title to shrink if container is small */
    min-width: 0;
}

.btn-clear-notes {
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 7px 14px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto; /* Push to the opposite side of title in RTL flex */
    margin-left: 10px;   /* Space for close modal button if they are on same side */
}

.btn-clear-notes:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.5);
    color: #fecdd3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-clear-notes:active {
    transform: translateY(0);
}

.note-list {
    padding: 20px;
    overflow-y: auto;
    background: #fdfdfd;
}

.notification-item {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 15px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.notification-item.unread {
    border-right: 5px solid #3b82f6;
    background: #f0f7ff;
}

.notification-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    align-items: center;
}

.note-title {
    font-weight: 800;
    font-size: 1rem;
    color: #0f172a;
}

.note-time {
    font-size: 0.75rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
}

.note-msg {
    margin: 0;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
    font-weight: 500;
}

.note-footer {
    margin-top: 10px;
    font-size: 0.75rem;
    color: #64748b;
    border-top: 1px dashed #e2e8f0;
    padding-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.close-modal {
    position: absolute;
    top: 35px; /* Position it centered vertically within the header */
    transform: translateY(-50%);
    right: 15px; /* Position at the right edge (start side in RTL) */
    font-size: 18px; /* Slightly smaller for better fit */
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    z-index: 100;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.15);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

@keyframes slideUpModal {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
