/* 
 * SDMIS Admin Panel Stylesheet
 * Enterprise-grade UI redesign
 */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #0f172a;
    --accent-color: #e11d48;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 64px;
    
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Sidebar Styling */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--secondary-color);
    color: #fff;
    z-index: 1040;
    transition: transform 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.admin-sidebar__brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    gap: 12px;
}

.admin-sidebar__logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    padding: 2px;
}

.admin-sidebar__title {
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.admin-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.admin-sidebar__menu-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.4);
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.admin-sidebar__menu-title:first-child {
    margin-top: 0;
}

.admin-sidebar__link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 12px;
    border-left: 3px solid transparent;
}

.admin-sidebar__link:hover, 
.admin-sidebar__link.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: var(--primary-color);
}

.admin-sidebar__link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Topbar Styling */
.admin-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background: var(--bg-white);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: var(--shadow-sm);
    transition: left 0.3s ease;
}

.admin-topbar__btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-topbar__btn:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* Main Content Area */
.admin-main {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.3s ease;
}

/* Cards & Panels */
.admin-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s ease;
}

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

.admin-card__header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(248, 250, 252, 0.5);
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.admin-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-card__body {
    padding: 1.5rem;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: var(--bg-white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

/* Tables */
.table-responsive {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--bg-light);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

/* Login Page Specific */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e2e8f0 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.5);
}

.login-header {
    background: var(--secondary-color);
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
}

.login-header__logo {
    width: 72px;
    height: 72px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-md);
}

/* Responsive Utilities */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.show {
        transform: translateX(0);
    }
    
    .admin-topbar {
        left: 0;
        padding: 0 1rem;
    }
    
    .admin-main {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}

/* --- Modern Enhancements --- */
.admin-card {
    border: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background: linear-gradient(to bottom, #ffffff, #fcfdfd);
}

.admin-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.admin-card__header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.form-control, .form-select {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-white);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-group-text {
    background-color: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Gradient Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #1e3a8a);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1060;
}

.modern-toast {
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    margin-top: 1rem;
    min-width: 300px;
    animation: slideInRight 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modern-toast.success {
    border-left-color: #10b981;
}

.modern-toast.error {
    border-left-color: var(--accent-color);
}

.toast-body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.25rem;
    color: var(--text-main);
    font-weight: 500;
}

.toast-icon {
    font-size: 1.25rem;
}

.modern-toast.success .toast-icon { color: #10b981; }
.modern-toast.error .toast-icon { color: var(--accent-color); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loaders */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 1.2rem;
    height: 1.2rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
