/* ============================================
   FSJESAC Forms - Main Stylesheet
   University Hassan II de Casablanca
   ============================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F0F2F5;
    color: #1A1A1A;
    line-height: 1.6;
    min-height: 100vh;
}

body[dir="rtl"] {
    font-family: 'Segoe UI', 'Arabic Typesetting', Tahoma, sans-serif;
}

a {
    color: #1A5276;
    text-decoration: none;
}

a:hover {
    color: #2E86C1;
}

/* ============================================
   HEADER - University Branding
   ============================================ */
.header {
    background: #FFFFFF;
    border-bottom: 1px solid #E5E5E5;
    padding: 12px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo img {
    height: 50px;
    width: auto;
}

.header-logo .logo-placeholder {
    width: 50px;
    height: 50px;
    background: #F8F9FA;
    border: 2px solid #E5E5E5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    text-align: center;
}

.header-info h1 {
    font-size: 16px;
    color: #1A1A1A;
    font-weight: 600;
    margin-bottom: 2px;
}

.header-info p {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lang-switch {
    display: flex;
    gap: 5px;
}

.lang-switch a {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    border: 1px solid #DDD;
    transition: all 0.2s;
}

.lang-switch a.active,
.lang-switch a:hover {
    background: #1A5276;
    color: #FFF;
    border-color: #1A5276;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: #F8F9FA;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
}

.user-menu .user-icon {
    width: 32px;
    height: 32px;
    background: #1A5276;
    color: #FFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.user-menu .logout-btn {
    color: #C0392B;
    font-size: 13px;
    margin-left: 10px;
    padding: 4px 8px;
    border-radius: 4px;
}

.user-menu .logout-btn:hover {
    background: #FDEDEC;
}

/* ============================================
   NAVIGATION
   ============================================ */
.nav-bar {
    background: #1A5276;
    padding: 0 30px;
}

.nav-bar ul {
    list-style: none;
    display: flex;
    gap: 0;
}

.nav-bar ul li a {
    display: block;
    padding: 12px 20px;
    color: #D6EAF8;
    font-size: 14px;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-bar ul li a:hover,
.nav-bar ul li a.active {
    background: rgba(255,255,255,0.1);
    color: #FFFFFF;
    border-bottom-color: #F39C12;
}

body[dir="rtl"] .nav-bar ul {
    flex-direction: row-reverse;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    font-size: 22px;
    color: #1A1A1A;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1A5276;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: #FFFFFF;
    border-radius: 8px;
    border: 1px solid #E5E5E5;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #EEE;
}

.card-header h2 {
    font-size: 18px;
    color: #1A1A1A;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border-top: 4px solid #1A5276;
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #1A5276;
    margin: 10px 0 5px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-icon {
    font-size: 28px;
    color: #1A5276;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table thead {
    background: #F8F9FA;
}

table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #E5E5E5;
}

body[dir="rtl"] table th {
    text-align: right;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #EEE;
    color: #444;
}

table tbody tr:hover {
    background: #F8F9FA;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-group label .required {
    color: #C0392B;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #DDD;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    transition: border-color 0.2s;
    background: #FFF;
}

.form-control:focus {
    outline: none;
    border-color: #1A5276;
    box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.1);
}

select.form-control {
    appearance: auto;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: #1A5276;
    color: #FFF;
}

.btn-primary:hover {
    background: #154360;
    color: #FFF;
}

.btn-success {
    background: #27AE60;
    color: #FFF;
}

.btn-success:hover {
    background: #219A52;
    color: #FFF;
}

.btn-danger {
    background: #C0392B;
    color: #FFF;
}

.btn-danger:hover {
    background: #A93226;
    color: #FFF;
}

.btn-secondary {
    background: #ECF0F1;
    color: #333;
    border: 1px solid #DDD;
}

.btn-secondary:hover {
    background: #D5DBDB;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   BADGES & STATUS
   ============================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background: #D4EDDA;
    color: #155724;
}

.badge-inactive {
    background: #F8D7DA;
    color: #721C24;
}

.badge-pending {
    background: #FFF3CD;
    color: #856404;
}

.badge-approved {
    background: #D4EDDA;
    color: #155724;
}

.badge-rejected {
    background: #F8D7DA;
    color: #721C24;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #F0F2F5;
}

.login-header {
    background: #FFFFFF;
    border-bottom: 1px solid #E5E5E5;
    padding: 20px 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 18px;
    color: #1A1A1A;
    margin-bottom: 3px;
}

.login-header p {
    font-size: 13px;
    color: #666;
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-box {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.login-box h2 {
    text-align: center;
    color: #1A5276;
    margin-bottom: 25px;
    font-size: 20px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.login-error {
    background: #F8D7DA;
    color: #721C24;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    border: 1px solid #F5C6CB;
}

/* ============================================
   FORM BUILDER (Admin)
   ============================================ */
.field-list {
    list-style: none;
    padding: 0;
}

.field-item {
    background: #F8F9FA;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.field-item .field-handle {
    cursor: move;
    color: #999;
    font-size: 18px;
}

.field-item .field-info {
    flex: 1;
}

.field-item .field-info .field-label {
    font-weight: 500;
    color: #333;
}

.field-item .field-info .field-type {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.field-item .field-actions {
    display: flex;
    gap: 8px;
}

/* Field type selector */
.field-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.field-type-btn {
    padding: 12px;
    background: #F8F9FA;
    border: 2px solid #E5E5E5;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.field-type-btn:hover {
    border-color: #1A5276;
    background: #EBF5FB;
}

.field-type-btn .icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.alert-error {
    background: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.alert-info {
    background: #D1ECF1;
    color: #0C5460;
    border: 1px solid #BEE5EB;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #666;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #CCC;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-info h1 {
        font-size: 14px;
    }

    .nav-bar ul {
        flex-wrap: wrap;
    }

    .main-content {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-box {
        padding: 25px;
    }
}

/* ============================================
   UTILITY
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
