/* ==========================================================================
   FSJP Tanger — Plateforme des demandes étudiantes
   Palette: institutional blue from the faculty logo
   ========================================================================== */

:root {
    --blue-900: #123a7a;
    --blue-700: #1a4f9e;
    --blue-600: #2060bd;
    --blue-100: #e8effa;
    --blue-50:  #f4f8fd;
    --ink:      #1f2937;
    --muted:    #5b6b7f;
    --line:     #d8e0ea;
    --bg:       #f2f5f9;
    --surface:  #ffffff;
    --red-700:  #b4232a;
    --red-100:  #fdeaea;
    --green-700:#1d7a45;
    --green-100:#e3f6ec;
    --amber-700:#9a6700;
    --amber-100:#fff4d6;
    --radius:   12px;
    --shadow:   0 6px 24px rgba(18, 58, 122, .10);
    --shadow-sm:0 2px 8px rgba(18, 58, 122, .08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin-inline: auto;
    padding-inline: 16px;
}

.main-content { flex: 1 0 auto; padding-block: 28px 48px; }

img { max-width: 100%; height: auto; }

.ar { font-family: Tahoma, "Segoe UI", sans-serif; }

/* ------------------------------------------------------------- header */
.site-header {
    background: var(--surface);
    border-bottom: 3px solid var(--blue-700);
    box-shadow: var(--shadow-sm);
}
.site-header .container { text-align: center; padding-block: 14px 10px; }
.brand { display: inline-block; }
.brand-banner {
    width: min(560px, 88vw);
    display: block;
    margin-inline: auto;
}

.breadcrumb {
    margin: 2px 0 20px;
    font-size: .85rem;
    color: var(--muted);
}
.breadcrumb a { color: var(--blue-700); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- home */
.page-intro { text-align: center; margin-bottom: 28px; }
.page-intro h1 { margin: 4px 0 6px; color: var(--blue-900); font-size: clamp(1.35rem, 4vw, 1.9rem); }
.page-intro p { margin: 0; color: var(--muted); }

.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
@media (min-width: 720px) {
    .cards { grid-template-columns: 1fr 1fr; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--blue-700);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.card-body { padding: 22px 22px 8px; flex: 1; }
.card h2 { margin: 0 0 8px; font-size: 1.15rem; color: var(--blue-900); }
.card-desc { margin: 0 0 14px; color: var(--muted); font-size: .95rem; }
.card-action {
    margin: 12px 22px 22px;
    text-align: center;
}

/* ------------------------------------------------------------- badges */
.badge {
    display: inline-block;
    margin: 4px 0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
}
.badge-open     { background: var(--green-100); color: var(--green-700); }
.badge-upcoming { background: var(--amber-100); color: var(--amber-700); }
.badge-closed   { background: var(--red-100);   color: var(--red-700); }

/* ------------------------------------------------------------- alerts */
.alert {
    border-radius: 10px;
    padding: 14px 16px;
    margin: 0 0 18px;
    border: 1px solid transparent;
    font-size: .95rem;
}
.alert-error   { background: var(--red-100);   color: var(--red-700);   border-color: #f3c2c5; }
.alert-success { background: var(--green-100); color: var(--green-700); border-color: #bfe6d1; }
.alert-info    { background: var(--blue-100);  color: var(--blue-900);  border-color: #c3d6f2; }
.alert-warning { background: var(--amber-100); color: var(--amber-700); border-color: #f0d795; }

/* ------------------------------------------------------------- panels & forms */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.panel-title { margin: 0 0 4px; color: var(--blue-900); font-size: 1.2rem; }
.panel-sub { margin: 0 0 18px; color: var(--muted); font-size: .92rem; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 640px) {
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.field label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 6px;
    color: var(--ink);
}
.field input,
.field select {
    width: 100%;
    padding: 11px 12px;
    font-size: 1rem;
    color: var(--ink);
    background: #fbfcfe;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(32, 96, 189, .18);
    background: #fff;
}
.field .field-error {
    display: none;
    margin-top: 5px;
    color: var(--red-700);
    font-size: .82rem;
}
.field.invalid input,
.field.invalid select { border-color: var(--red-700); }
.field.invalid .field-error { display: block; }
.field .field-hint { margin-top: 5px; color: var(--muted); font-size: .78rem; }

.form-actions { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------- buttons */
.btn {
    display: inline-block;
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    font-size: .98rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-secondary { background: var(--blue-100); color: var(--blue-900); }
.btn-secondary:hover { background: #d7e4f7; }
.btn-success { background: var(--green-700); color: #fff; }
.btn-success:hover { background: #19673b; }
.btn[disabled], .btn.is-loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; text-align: center; }

/* ------------------------------------------------------------- info table */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    background: var(--surface);
    font-size: .95rem;
}
.info-table th,
.info-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.info-table th {
    width: 220px;
    color: var(--muted);
    font-weight: 600;
    background: var(--blue-50);
    white-space: nowrap;
}
.info-table tr:last-child th,
.info-table tr:last-child td { border-bottom: none; }
@media (max-width: 560px) {
    .info-table th, .info-table td { display: block; width: 100%; }
    .info-table th { border-bottom: none; padding-bottom: 2px; }
    .info-table td { padding-top: 2px; }
}

/* ------------------------------------------------------------- modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 34, 66, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}
.modal-overlay.is-open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
    max-width: 520px;
    width: 100%;
    padding: 26px;
    animation: modal-in .18s ease-out;
}
@keyframes modal-in {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.modal h3 { margin: 0 0 10px; color: var(--blue-900); }
.modal p { margin: 0 0 8px; }
.modal .modal-summary {
    background: var(--blue-50);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0 18px;
    font-size: .92rem;
}
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ------------------------------------------------------------- closed states */
.platform-closed {
    text-align: center;
    padding: 46px 26px 40px;
    max-width: 640px;
    margin-inline: auto;
    border-top: 4px solid var(--red-700);
}
.platform-closed .closed-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    margin-bottom: 6px;
}
.platform-closed h2 {
    margin: 10px 0 0;
    color: var(--blue-900);
    font-size: clamp(1.3rem, 3.5vw, 1.6rem);
}
.platform-closed .closed-sub {
    margin: 4px 0 0;
    color: var(--red-700);
    font-weight: 600;
    font-size: 1.05rem;
}
.platform-closed .closed-text {
    margin: 16px auto 0;
    max-width: 480px;
    color: var(--ink);
}
.closed-date {
    display: inline-block;
    margin-top: 14px;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    background: var(--red-100);
    color: var(--red-700);
}
.closed-sep {
    border: none;
    border-top: 1px solid var(--line);
    margin: 22px auto 16px;
    max-width: 380px;
}
.platform-closed .closed-contact {
    margin: 0 auto;
    max-width: 480px;
    color: var(--muted);
    font-size: .9rem;
}

.card-is-upcoming { border-top-color: var(--amber-700); }
.card-is-closed   { opacity: .75; border-top-color: var(--red-700); }
.card-is-closed .card-body,
.card-is-upcoming .card-body { padding-bottom: 22px; }
.card-action.btn:disabled { opacity: .65; cursor: not-allowed; }

/* ------------------------------------------------------------- misc */
.result-zone { margin-top: 4px; }
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: -3px;
    margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- footer */
.site-footer {
    flex-shrink: 0;
    background: var(--blue-900);
    color: #dbe6f7;
    margin-top: 24px;
}
.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-block: 18px;
    text-align: center;
}
.footer-logo { width: 58px; height: 58px; object-fit: contain; background: #fff; border-radius: 50%; padding: 4px; }
.footer-text { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .9rem; }
.footer-copy {
    text-align: center;
    font-size: .78rem;
    color: #9fb7dd;
    border-top: 1px solid rgba(255, 255, 255, .15);
    padding-block: 10px;
}
