/* Discipline module styles — shared by the "תלמידים" hub (students.html).
   Extracted from the former standalone discipline.html page. */

body {
    background-color: #f8f9ff;
    font-family: 'Rubik', sans-serif;
    color: #0b1c30;
    margin: 0;
    padding: 0;
}

.header-bar {
    background: rgba(248, 249, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #E2E8F0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 64px;
    box-sizing: border-box;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0b1c30;
}

.header-link {
    text-decoration: none;
    color: #006194;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Tabs (top-level on the hub page) */
.tabs-nav {
    display: flex;
    background: #eff4ff;
    border: 1px solid #E2E8F0;
    border-radius: 9999px;
    padding: 4px;
    margin-bottom: 1.5rem;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 9px 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3f4850;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: #006194;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 97, 148, 0.25);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Inner discipline tabs (report / history) */
.dtab-btn {
    flex: 1;
    text-align: center;
    padding: 9px 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3f4850;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dtab-btn.active {
    background: #006194;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 97, 148, 0.25);
}

.dtab-content {
    display: none;
}

.dtab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

/* Form Card */
.app-card {
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1.5rem;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0b1c30;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search Autocomplete */
.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1.5px solid #CBD5E1;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
    color: #0b1c30;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: #006194;
    box-shadow: 0 0 0 3px rgba(0, 97, 148, 0.12);
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    max-height: 260px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
    background: #eff4ff;
}

.student-pill {
    background: #eff4ff;
    border: 1.5px solid #cce5ff;
    border-radius: 1rem;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.student-pill-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.student-name-bold {
    font-weight: 700;
    font-size: 1.05rem;
    color: #006194;
}

.student-class-tag {
    font-size: 0.85rem;
    color: #007bb9;
    font-weight: 600;
}

.btn-change-student {
    background: #ffffff;
    border: 1px solid #cce5ff;
    color: #006194;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-change-student:hover {
    background: #eff4ff;
}

/* Violation Buttons */
.violation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.25rem;
}

@media (max-width: 500px) {
    .violation-grid {
        grid-template-columns: 1fr;
    }
}

.violation-card {
    border: 1.5px solid #E2E8F0;
    border-radius: 1rem;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    user-select: none;
}

.violation-card:hover {
    border-color: #006194;
    background: #f8f9ff;
}

.violation-card .icon {
    font-size: 2rem;
}

.violation-card .label {
    font-weight: 700;
    font-size: 1rem;
    color: #0b1c30;
}

.violation-card.active {
    border-color: #006194;
    background: #eff4ff;
    box-shadow: 0 4px 14px rgba(0, 97, 148, 0.12);
}

.violation-card.active .label {
    color: #006194;
}

/* Consequence / Action Banner */
.consequence-box {
    background: #eff4ff;
    border: 1.5px solid #cce5ff;
    border-radius: 1rem;
    padding: 14px 16px;
    margin-bottom: 1.25rem;
    display: none;
}

.consequence-box.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.consequence-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #006194;
    margin-bottom: 4px;
}

.consequence-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0b1c30;
}

/* Notes & Fields */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #3f4850;
    margin-bottom: 6px;
}

.text-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #ffffff;
    color: #0b1c30;
}

.text-input:focus {
    border-color: #006194;
    box-shadow: 0 0 0 3px rgba(0, 97, 148, 0.12);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    background: #006194;
    color: #ffffff;
    border: none;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 97, 148, 0.25);
    transition: all 0.2s ease;
    min-height: 48px;
}

.btn-submit:hover {
    background: #007bb9;
    box-shadow: 0 6px 16px rgba(0, 97, 148, 0.35);
}

.btn-submit:active {
    transform: scale(0.98);
}

/* Success & Cancel Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    display: none;
}

.modal-card {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 30px rgba(0,0,0,0.2);
    animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #d1fae5;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem auto;
}

.countdown-circle {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 800;
    font-size: 1.5rem;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    margin: 1rem 0;
    letter-spacing: 1px;
}

.btn-cancel-incident {
    width: 100%;
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-close-modal {
    width: 100%;
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

/* History Table & Cards */
.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
}

.select-filter {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    background: #ffffff;
}

.incident-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.incident-card.cancelled {
    opacity: 0.6;
    background: #f8fafc;
    border-style: dashed;
}

.badge-violation {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-dress { background: #e0e7ff; color: #3730a3; }
.badge-phone { background: #fef3c7; color: #92400e; }
.badge-smoking { background: #fee2e2; color: #991b1b; }
.badge-cancel { background: #fee2e2; color: #991b1b; }

/* Letter Modal & Print Styles */
.btn-letter-print {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}
.btn-letter-print:hover {
    background: #0369a1;
}
.btn-letter-pdf {
    background: #dc2626;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}
.btn-letter-pdf:hover {
    background: #b91c1c;
}
.btn-letter-preview {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    transition: background 0.2s;
}
.btn-letter-preview:hover {
    background: #e0e7ff;
}
.btn-history-letter {
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-history-letter:hover {
    background: #eef2ff;
    border-color: #818cf8;
    color: #4338ca;
}
.btn-history-delete {
    background: #fff5f5;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-history-delete:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #991b1b;
}

/* Modal Window for Letter */
.letter-modal-card {
    max-width: 860px !important;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem !important;
    overflow: hidden;
    box-sizing: border-box;
}
.letter-modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
    gap: 10px;
}
.letter-sheet-wrapper {
    overflow-y: auto;
    background: #cbd5e1;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    flex: 1;
}

/* The Official Document Sheet */
.letter-document-sheet {
    background: #ffffff;
    width: 100%;
    max-width: 740px;
    min-height: auto;
    padding: 24px 34px 28px 34px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-radius: 4px;
    color: #0f172a;
    font-family: 'Rubik', sans-serif;
    line-height: 1.45;
    text-align: right;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
}

.letter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1e293b;
    padding-bottom: 8px;
    margin-bottom: 10px;
}
.letter-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.letter-header-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
.letter-header-titles h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}
.letter-header-titles h4 {
    margin: 2px 0 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
}
.letter-header-meta {
    text-align: left;
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.35;
}

.letter-title {
    text-align: center;
    margin: 6px 0 10px 0;
}
.letter-title h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e1b4b;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.letter-salutation {
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 600;
    color: #1e293b;
}

.letter-intro-text {
    font-size: 0.86rem;
    color: #334155;
    margin-bottom: 10px;
    text-align: justify;
    line-height: 1.4;
}

/* Incident Details Box */
.letter-details-box {
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
    margin-bottom: 10px;
}
.letter-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}
.letter-details-table tr:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}
.letter-details-table td {
    padding: 5px 10px;
    vertical-align: top;
}
.letter-details-table td.label-col {
    font-weight: 700;
    color: #475569;
    width: 28%;
    background: #f1f5f9;
}
.letter-details-table td.value-col {
    color: #0f172a;
    font-weight: 500;
}

.letter-concluding-text {
    font-size: 0.86rem;
    color: #334155;
    margin-bottom: 10px;
    line-height: 1.4;
}

.letter-signatures {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
    padding: 0 15px;
}
.letter-sign-block {
    text-align: center;
    min-width: 150px;
}
.letter-sign-line {
    border-bottom: 1px solid #475569;
    margin-top: 18px;
    margin-bottom: 4px;
}
.letter-sign-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
}
.letter-sign-role {
    font-size: 0.76rem;
    color: #64748b;
}

/* Perforated Slip for Parents */
.letter-slip {
    border-top: 2px dashed #94a3b8;
    padding-top: 10px;
    margin-top: 4px;
    position: relative;
    page-break-inside: avoid;
    break-inside: avoid;
}
.letter-slip-cut-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    padding: 0 10px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #64748b;
}
.letter-slip-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
    text-align: center;
}
.letter-slip-declaration {
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 6px;
    line-height: 1.35;
}
.letter-slip-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.78rem;
}
.letter-slip-field-line {
    border-bottom: 1px dotted #64748b;
    height: 15px;
    margin-top: 2px;
}
.letter-slip-notes-line {
    font-size: 0.78rem;
    color: #475569;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.letter-slip-notes-line span:last-child {
    flex: 1;
    border-bottom: 1px dotted #64748b;
    height: 15px;
}

/* Print Media Rules */
@page {
    size: A4 portrait;
    margin: 8mm 12mm 24mm 12mm;
}

@media print {
    html, body {
        height: auto !important;
        overflow: visible !important;
        background: #ffffff !important;
    }
    body:not(.printing-slips) * {
        visibility: hidden !important;
    }
    body:not(.printing-slips) #letterModal,
    body:not(.printing-slips) #letterModal * {
        visibility: visible !important;
    }
    body.printing-slips #slipsPrintArea,
    body.printing-slips #slipsPrintArea * {
        visibility: visible !important;
    }
    #letterModal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }
    .letter-modal-card {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .letter-modal-toolbar {
        display: none !important;
    }
    .letter-sheet-wrapper {
        padding: 0 !important;
        background: transparent !important;
        overflow: visible !important;
    }
    .letter-document-sheet {
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 2mm 6mm 14mm 6mm !important;
        margin: 0 auto !important;
        min-height: auto !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .letter-slip {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-bottom: 10mm !important;
    }
    .no-print {
        display: none !important;
    }
}
