/* ===== NOVATEK EM — MAIN STYLES ===== */
/* Inspired by Novatek Environmental Monitoring platform */

:root {
    /* Color Palette — Professional Pharmaceutical */
    --primary: #1a5276;
    --primary-light: #2980b9;
    --primary-dark: #0e2f44;
    --secondary: #27ae60;
    --secondary-light: #2ecc71;
    --accent: #f39c12;
    --danger: #e74c3c;
    --danger-light: #ff6b6b;
    --warning: #f1c40f;
    --info: #3498db;
    --success: #27ae60;

    /* Neutrals */
    --bg-body: #f4f6f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1a2332;
    --bg-sidebar-hover: #243447;
    --bg-sidebar-active: #2c3e50;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #bdc3c7;
    --text-white: #ffffff;
    --border: #e0e6ed;
    --border-light: #f0f3f6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.logo-text {
    color: var(--text-white);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    gap: 12px;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    border-left-color: var(--primary-light);
}

.nav-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.nav-text {
    color: var(--text-light);
    font-size: 14px;
    white-space: nowrap;
}

.nav-item.active .nav-text,
.nav-item:hover .nav-text {
    color: var(--text-white);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: var(--text-white);
    font-size: 13px;
    font-weight: 500;
}

.user-role {
    color: var(--text-light);
    font-size: 11px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-input {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    width: 200px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-light);
}

.notification-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    position: relative;
    padding: 6px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-date {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== CONTENT AREA ===== */
.content-area {
    padding: 24px;
}

/* ===== UTILITY CLASSES ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.grid {
    display: grid;
    gap: 16px;
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-light);
    color: white;
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--accent);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-body);
}

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

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--bg-body);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* Status Badges */
.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: #e8f8ef; color: #1e8449; }
.badge-warning { background: #fef9e7; color: #b7950b; }
.badge-danger { background: #fdedec; color: #c0392b; }
.badge-info { background: #eaf2f8; color: #2471a3; }
.badge-neutral { background: #f2f3f4; color: #566573; }

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

.tab:hover {
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

select.form-control {
    appearance: auto;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .main-content {
        margin-left: var(--sidebar-collapsed);
    }
    .nav-text, .logo-text, .user-details {
        display: none;
    }
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}
