/* ============================================
   EasyTimetables - Shared Application Styles
   Light, Professional SaaS Design
============================================ */

:root {
    --primary: #0AAAA4;
    --primary-light: #DDF7F5;
    --primary-dark: #07827F;
    --secondary: #19B6C4;
    --accent: #72D6B2;
    --accent-hover: #43C397;
    --bg-main: #F8FCFD;
    --bg-white: #FFFFFF;
    --text-main: #07345E;
    --text-muted: #5F748A;
    --surface: #EEF8FA;
    --success: #43C397;
    --warning: #F7B955;
    --error: #E85D75;
    --info: #19B6C4;
    --border-color: #DDECF0;
    --shadow: 0 2px 14px rgba(7, 52, 94, 0.07);
    --shadow-hover: 0 8px 28px rgba(10, 170, 164, 0.16);
    --radius-card: 12px;
    --radius-btn: 8px;
    --sidebar-width: 260px;
}

/* ============================================
   Global
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.7;
    font-size: 0.95rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-main);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

.text-primary {
    color: var(--primary) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

.link-primary {
    color: var(--primary) !important;
}

/* ============================================
   Layout - Sidebar + Main Content
============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-left: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
}

.app-sidebar .sidebar-brand {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    min-height: 76px;
    display: flex;
    align-items: center;
}

.brand-logo,
.sidebar-logo,
.auth-logo {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.sidebar-logo {
    width: 190px;
    max-height: 48px;
}

.auth-logo {
    width: 260px;
    max-height: 90px;
    margin: 0 auto 12px;
}

.brand-logo-landing {
    width: 230px;
    max-height: 68px;
    display: block;
    object-fit: contain;
}

.app-sidebar .sidebar-nav {
    padding: 15px 0;
    list-style: none;
}

.app-sidebar .sidebar-nav li {
    margin-bottom: 2px;
}

.app-sidebar .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 0;
    transition: all 0.2s ease;
}

.app-sidebar .sidebar-nav a:hover {
    background-color: var(--surface);
    color: var(--primary);
}

.app-sidebar .sidebar-nav a.active {
    background-color: var(--surface);
    color: var(--primary);
    font-weight: 600;
    border-right: 3px solid var(--primary);
}

.app-sidebar .sidebar-nav a i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.app-main {
    margin-right: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ============================================
   Top Navbar (App pages)
============================================ */
.app-topbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.app-topbar .page-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.app-topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-topbar .topbar-actions form {
    margin: 0;
}

.app-topbar .topbar-actions .btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.app-topbar .topbar-actions .btn-icon:hover {
    background: var(--primary-light);
    color: #fff;
}

.topbar-user-btn {
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 5px 10px 5px 12px;
    font-weight: 700;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    transition: all .2s ease;
}

.topbar-user-btn:focus,
.topbar-user-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .18rem rgba(10, 170, 164, .16);
}

.topbar-user-btn .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--primary-dark);
    flex: 0 0 auto;
    font-size: .88rem;
    font-weight: 900;
}

.topbar-user-btn .user-menu-name {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
    font-size: .86rem;
}

.topbar-user-btn .user-menu-arrow {
    color: var(--text-muted);
    font-size: .78rem;
}

.topbar-user-btn:hover {
    background: rgba(10, 170, 164, .1);
    color: var(--primary-dark);
}

.topbar-user-btn:hover .user-avatar {
    background: #fff;
    color: var(--primary);
}

.user-menu-dropdown .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px;
    min-width: 220px;
}

.user-menu-dropdown .dropdown-header {
    color: var(--text-main);
    padding: 10px 12px;
}

.user-menu-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 9px 10px;
    color: var(--text-main);
}

.user-menu-dropdown .dropdown-item:hover,
.user-menu-dropdown .dropdown-item:focus {
    background: rgba(10, 170, 164, .08);
    color: var(--primary-dark);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-main);
    cursor: pointer;
}

/* ============================================
   Content Area
============================================ */
.app-content {
    padding: 30px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.card,
.card-body,
.row,
.row > * {
    min-width: 0;
}

.table-responsive,
.schedule-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
}

/* ============================================
   Cards
============================================ */
.card {
    border: none;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    background: var(--bg-white);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* ============================================
   Stat Cards / Widgets
============================================ */
.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-icon.bg-primary-light {
    background: var(--surface);
    color: var(--primary);
}

.stat-card .stat-icon.bg-success-light {
    background: #e6f9ed;
    color: var(--success);
}

.stat-card .stat-icon.bg-warning-light {
    background: #fff5e6;
    color: var(--warning);
}

.stat-card .stat-icon.bg-error-light {
    background: #ffe6e6;
    color: var(--error);
}

.stat-card .stat-icon.bg-info-light {
    background: #e6f4ff;
    color: var(--info);
}

.stat-card .stat-info h3 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-card .stat-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   Buttons
============================================ */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: var(--radius-btn);
    font-weight: 600;
    padding: 10px 24px;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary:focus,
.btn-primary:active,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    box-shadow: 0 0 0 0.2rem rgba(10, 170, 164, 0.18) !important;
}

.btn-accent {
    background-color: var(--accent);
    border: none;
    color: #fff;
    border-radius: var(--radius-btn);
    font-weight: 600;
    padding: 10px 24px;
    transition: all 0.3s ease;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    border-radius: var(--radius-btn);
    font-weight: 600;
    padding: 10px 24px;
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-light-custom {
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-btn);
    font-weight: 500;
    padding: 10px 24px;
}

.btn-light-custom:hover {
    background: var(--primary-light);
    color: #fff;
    border-color: var(--primary-light);
}

/* ============================================
   Tables
============================================ */
.table {
    border-color: var(--border-color);
}

.table thead th {
    background: var(--surface);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    padding: 14px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: var(--border-color);
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: var(--surface);
}

/* ============================================
   Forms
============================================ */
.form-control, .form-select {
    border-radius: var(--radius-btn);
    border-color: var(--border-color);
    padding: 10px 16px;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(10, 170, 164, 0.16);
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

/* ============================================
   Badges
============================================ */
.badge-primary {
    background: var(--surface);
    color: var(--primary);
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.badge-success {
    background: #e6f9ed;
    color: #2b8a3e;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.badge-warning {
    background: #fff5e6;
    color: #e67700;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.badge-error {
    background: #ffe6e6;
    color: #c92a2a;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.badge-info {
    background: #e6f4ff;
    color: #1971c2;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* ============================================
   Schedule Table
============================================ */
.schedule-table {
    font-size: 0.82rem;
}

.schedule-table th, .schedule-table td {
    text-align: center;
    padding: 8px 6px;
    min-width: 60px;
}

.shift-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.shift-morning {
    background: #E7F9F2;
    color: #07827F;
}

.shift-evening {
    background: #EAFBFA;
    color: #0D7F89;
}

.shift-night {
    background: #EAF7FF;
    color: #07345E;
}

.shift-off {
    background: #f8f9fa;
    color: #adb5bd;
}

/* ============================================
   Toggle Switch
============================================ */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   Auth Pages
============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--surface) 100%);
    padding: 40px 20px;
}

.auth-card {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    padding: 40px;
    width: 100%;
    max-width: 520px;
}

.auth-card .auth-brand {
    text-align: center;
    margin-bottom: 30px;
}

.auth-card .auth-brand h2 {
    color: var(--primary);
    font-size: 1.6rem;
}

.auth-card .auth-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.step-indicator .step {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text-muted);
    transition: all 0.3s;
}

.step-indicator .step.active {
    background: var(--primary);
    color: #fff;
}

.step-indicator .step.completed {
    background: var(--success);
    color: #fff;
}

/* ============================================
   Sector Cards
============================================ */
.sector-card {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sector-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-hover);
}

.sector-card.selected {
    border-color: var(--primary);
    background: var(--surface);
}

.sector-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}

.sector-card h6 {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.sector-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   Pricing Cards
============================================ */
.pricing-card {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    padding: 35px 25px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    height: 100%;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.pricing-card.featured {
    border-color: var(--primary);
}

.pricing-card .price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 15px 0 5px;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    text-align: start;
    margin: 20px 0;
}

.pricing-card ul li {
    padding: 8px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pricing-card ul li i {
    color: var(--success);
}

/* ============================================
   Responsive
============================================ */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-right: 0;
        max-width: 100vw;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .app-content {
        padding: 20px 15px;
    }

    .app-topbar {
        padding: 12px 15px;
    }

    .topbar-user-btn {
        min-width: 38px;
        min-height: 38px;
        justify-content: center;
        padding: 4px;
        border-radius: 50%;
    }

    .topbar-user-btn .user-menu-name,
    .topbar-user-btn .user-menu-arrow {
        display: none;
    }

    .topbar-user-btn .user-avatar {
        width: 30px;
        height: 30px;
    }

    .stat-card {
        padding: 18px;
    }
}

/* ============================================
   Print Styles
============================================ */
@media print {
    .app-sidebar,
    .app-topbar,
    .sidebar-toggle,
    .btn,
    .no-print {
        display: none !important;
    }

    .app-main {
        margin-right: 0 !important;
    }

    .app-content {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    body {
        background: #fff !important;
    }
}
