/* =============================================================================
   SMS TERTIARY MODERN REDESIGN SYSTEM
   Theme: Elegant & Minimal | Colors: var(--primary-color) / var(--secondary-color)
   ============================================================================= */

/* ---------------------------------- */
/* GLOBAL VARIABLES & DESIGN TOKENS   */
/* ---------------------------------- */
:root {
    --primary-color: #050C9C;
    --secondary-color: #3572EF;
    --accent-color: #3ABEF9;
    --background-color: #A7E6FF;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 8px;
    --transition-speed: 0.25s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(5, 12, 156, 0.03);
    --shadow-md: 0 4px 20px rgba(5, 12, 156, 0.05);
    --shadow-lg: 0 10px 30px rgba(5, 12, 156, 0.08);
}

/* ---------------------------------- */
/* BASE & RESET                       */
/* ---------------------------------- */
* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-color);
    background-color: #f8fafc;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 600;
    color: #0f172a;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-speed) var(--transition-ease);
}

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

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

/* ---------------------------------- */
/* APP SHELL & LAYOUT                 */
/* ---------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: 280px; /* Width of expanded sidebar */
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) var(--transition-ease);
}

/* ---------------------------------- */
/* SIDEBAR (DEFAULT & COLLAPSED)      */
/* ---------------------------------- */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: rgba(255, 255, 255, 0.9);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1040;
    padding-top: 10px;
    box-shadow: 4px 0 24px rgba(5, 12, 156, 0.08);
    transition: width var(--transition-speed) var(--transition-ease), transform var(--transition-speed) var(--transition-ease);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
}

.sidebar-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    padding: 12px 24px 6px;
    text-transform: uppercase;
    transition: opacity var(--transition-speed) var(--transition-ease);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all var(--transition-speed) var(--transition-ease);
    border-left: 4px solid transparent;
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-link i {
    margin-right: 14px;
    width: 24px;
    text-align: center;
    font-size: 1.15rem;
    transition: margin-right var(--transition-speed) var(--transition-ease);
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-left-color: var(--accent-color);
}

.sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-left-color: var(--accent-color);
    font-weight: 600;
}

.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.sidebar-link.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.15);
    color: #f87171 !important;
}

/* Collapsed Sidebar State (Desktop) */
.sidebar-collapsed .sidebar {
    width: 85px;
}

.sidebar-collapsed .main-content {
    margin-left: 85px;
}

.sidebar-collapsed .sidebar-header h5,
.sidebar-collapsed .sidebar-header .btn-close,
.sidebar-collapsed .sidebar-link span,
.sidebar-collapsed .sidebar-section-title,
.sidebar-collapsed .sidebar-divider {
    display: none !important;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 16px 0;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 15px 0;
    border-left: 4px solid transparent;
}

.sidebar-collapsed .sidebar-link i {
    margin-right: 0;
    font-size: 1.35rem;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1030;
    opacity: 0;
    transition: opacity var(--transition-speed) var(--transition-ease);
}

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

/* ---------------------------------- */
/* STICKY NAV BAR                     */
/* ---------------------------------- */
.navbar {
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: all var(--transition-speed) var(--transition-ease);
}

/* ---------------------------------- */
/* OVERRIDING CARDS                   */
/* ---------------------------------- */
.card {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform var(--transition-speed) var(--transition-ease), box-shadow var(--transition-speed) var(--transition-ease) !important;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg) !important;
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 16px 20px !important;
    font-weight: 600;
}

.card-body {
    padding: 20px !important;
}

.card-footer {
    background-color: transparent !important;
    border-top: 1px solid var(--border-color) !important;
    padding: 16px 20px !important;
}

/* Icon Box utility */
.icon-box {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px !important;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ---------------------------------- */
/* OVERRIDING BUTTONS                 */
/* ---------------------------------- */
.btn {
    border-radius: var(--border-radius-md);
    padding: 10px 20px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-speed) var(--transition-ease);
    box-shadow: var(--shadow-sm);
}

.btn:active, .btn:focus {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    box-shadow: 0 4px 12px rgba(5, 12, 156, 0.25) !important;
}

.btn-secondary {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #0f172a !important;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #ffffff !important;
}

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

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--secondary-color) !important;
    color: #ffffff !important;
}

.btn-danger {
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15) !important;
}

.btn-pill, .rounded-pill {
    border-radius: 50rem !important;
}

/* ---------------------------------- */
/* OVERRIDING FORMS                   */
/* ---------------------------------- */
.form-control, .form-select {
    height: 48px;
    border-radius: var(--border-radius-md) !important;
    border: 1px solid var(--border-color) !important;
    background-color: #ffffff !important;
    font-size: 0.95rem;
    padding: 10px 16px;
    color: var(--text-color) !important;
    transition: border-color var(--transition-speed) var(--transition-ease), box-shadow var(--transition-speed) var(--transition-ease) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--secondary-color) !important;
    box-shadow: 0 0 0 4px rgba(53, 114, 239, 0.12) !important;
    outline: 0;
}

textarea.form-control {
    height: auto !important;
    min-height: 100px;
}

.form-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}

/* Form floating override */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    color: var(--secondary-color) !important;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem) !important;
}

/* ---------------------------------- */
/* OVERRIDING TABLES                  */
/* ---------------------------------- */
.table-responsive {
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    overflow-x: auto;
}

.table {
    margin-bottom: 0 !important;
    width: 100%;
}

.table th {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.table td {
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-size: 0.9rem;
    color: var(--text-color);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(167, 230, 255, 0.15) !important;
}

.table-hover tbody tr:hover {
    background-color: rgba(167, 230, 255, 0.25) !important;
    cursor: pointer;
}

/* ---------------------------------- */
/* OVERRIDING ALERTS                  */
/* ---------------------------------- */
.alert {
    border-radius: var(--border-radius-md) !important;
    border: none !important;
    padding: 16px 20px !important;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-primary {
    background-color: rgba(53, 114, 239, 0.1) !important;
    color: var(--secondary-color) !important;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1) !important;
    color: #15803d !important;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #b91c1c !important;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1) !important;
    color: #b45309 !important;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: #1d4ed8 !important;
}

/* ---------------------------------- */
/* OVERRIDING MODALS                  */
/* ---------------------------------- */
.modal-content {
    border: none !important;
    border-radius: var(--border-radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 20px !important;
}

.modal-footer {
    border-top: 1px solid var(--border-color) !important;
    padding: 16px 20px !important;
}

/* ---------------------------------- */
/* RESPONSIVENESS AND LAYOUT BREAKER  */
/* ---------------------------------- */

@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0 !important;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

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

/* Fade-in Animation for main contents */
.fade-in {
    animation: fadeIn var(--transition-speed) var(--transition-ease);
}

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