/* ========================================
   Kitchen Safety Portal - Main Stylesheet
   ======================================== */

:root {
    --primary: #00d4aa;
    --primary-dark: #00b894;
    --secondary: #6c5ce7;
    --accent: #00b4d8;
    --bg-dark: #0f0f23;
    --bg-sidebar: #1a1f36;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-light: #b2bec3;
    --danger: #ff4757;
    --warning: #ffa502;
    --success: #2ed573;
    --border: #e9ecef;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-width: 270px;
    --topbar-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--bg-sidebar);
    color: #fff; z-index: 1040;
    display: flex; flex-direction: column;
    transition: var(--transition);
    border-right: 1px solid rgba(255,255,255,0.05);
}

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

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

.logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
    box-shadow: 0 4px 15px rgba(0,212,170,0.3);
}

.logo-text h2 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.5px; }
.logo-text span { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1px; }

.sidebar-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }

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

.nav-section { margin-bottom: 24px; }
.nav-section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1.2px; color: rgba(255,255,255,0.35);
    padding: 0 12px; margin-bottom: 8px; display: block;
}

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: rgba(255,255,255,0.65); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: var(--transition); margin-bottom: 2px;
}
.sidebar-nav .nav-link i { font-size: 18px; width: 22px; text-align: center; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(0,212,170,0.2), rgba(0,180,216,0.15));
    box-shadow: inset 3px 0 0 var(--primary);
}

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

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

.user-avatar-sm {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role-badge {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--primary); font-weight: 600;
}
.user-role-badge.admin { color: var(--danger); }
.user-role-badge.manager { color: var(--secondary); }

.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 1035;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* Top Navbar */
.top-navbar {
    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 28px;
    position: sticky; top: 0; z-index: 1020;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.nav-left { display: flex; align-items: center; gap: 16px; }

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

.page-title { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.3px; }
.page-subtitle { font-size: 12px; color: var(--text-secondary); margin: 0; }

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

.nav-date {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    padding: 8px 14px; background: var(--bg-main);
    border-radius: 10px;
}

.notification-btn {
    position: relative; background: none; border: none;
    font-size: 20px; color: var(--text-secondary); cursor: pointer;
    padding: 8px; border-radius: 10px; transition: var(--transition);
}
.notification-btn:hover { background: var(--bg-main); color: var(--text-primary); }

.notification-badge {
    position: absolute; top: 4px; right: 4px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.notification-dropdown { width: 320px; border: none; box-shadow: var(--shadow-lg); border-radius: var(--radius); padding: 0; }

.profile-btn {
    display: flex; align-items: center; gap: 10px;
    background: none; border: none; cursor: pointer;
    padding: 6px 10px; border-radius: 10px; transition: var(--transition);
}
.profile-btn:hover { background: var(--bg-main); }

.profile-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #fff;
}

.profile-info { display: flex; flex-direction: column; text-align: left; }
.profile-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.profile-role { font-size: 11px; color: var(--text-secondary); }

/* Content */
.content-wrapper { padding: 28px; }

/* Stat Cards */
.stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 24px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 4px;
}
.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card.secondary::before { background: linear-gradient(90deg, var(--secondary), #a29bfe); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #ffeaa7); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #ff6b81); }

.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-bottom: 16px;
}
.stat-icon.primary { background: rgba(0,212,170,0.12); color: var(--primary); }
.stat-icon.secondary { background: rgba(108,92,231,0.12); color: var(--secondary); }
.stat-icon.warning { background: rgba(255,165,2,0.12); color: var(--warning); }
.stat-icon.danger { background: rgba(255,71,87,0.12); color: var(--danger); }

.stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; letter-spacing: -1px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Cards */
.card-custom {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    overflow: hidden;
}

.card-custom .card-header {
    background: transparent; border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between;
}

.card-custom .card-header h5 {
    font-size: 16px; font-weight: 700; margin: 0;
    display: flex; align-items: center; gap: 8px;
}

.card-custom .card-body { padding: 24px; }

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none; color: #fff; font-weight: 600;
    padding: 10px 24px; border-radius: 10px;
    transition: var(--transition); font-size: 14px;
}
.btn-primary-custom:hover {
    transform: translateY(-2px); color: #fff;
    box-shadow: 0 8px 25px rgba(0,212,170,0.35);
}

.btn-outline-custom {
    background: transparent; border: 1.5px solid var(--primary);
    color: var(--primary); font-weight: 600;
    padding: 10px 24px; border-radius: 10px;
    transition: var(--transition); font-size: 14px;
}
.btn-outline-custom:hover {
    background: var(--primary); color: #fff;
}

.btn-sm-custom {
    padding: 6px 14px; font-size: 12px; border-radius: 8px;
}

/* Tables */
.table-custom { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-custom thead th {
    background: var(--bg-main); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-secondary); padding: 14px 16px;
    border-bottom: 2px solid var(--border);
}
.table-custom tbody td {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    font-size: 14px; vertical-align: middle;
}
.table-custom tbody tr { transition: var(--transition); }
.table-custom tbody tr:hover { background: rgba(0,212,170,0.04); }

/* Badges */
.badge-status {
    padding: 5px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.badge-status.completed { background: rgba(46,213,115,0.12); color: var(--success); }
.badge-status.in_progress, .badge-status.in-progress { background: rgba(255,165,2,0.12); color: var(--warning); }
.badge-status.reviewed { background: rgba(108,92,231,0.12); color: var(--secondary); }
.badge-status.pass { background: rgba(46,213,115,0.12); color: var(--success); }
.badge-status.fail { background: rgba(255,71,87,0.12); color: var(--danger); }

/* Score circle */
.score-circle {
    width: 60px; height: 60px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; color: #fff;
}
.score-circle.high { background: linear-gradient(135deg, var(--success), #7bed9f); }
.score-circle.medium { background: linear-gradient(135deg, var(--warning), #ffeaa7); color: #333; }
.score-circle.low { background: linear-gradient(135deg, var(--danger), #ff6b81); }

/* Check Form */
.check-category-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    margin-bottom: 20px; overflow: hidden;
    transition: var(--transition);
}

.check-category-header {
    padding: 18px 24px;
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; transition: var(--transition);
}
.check-category-header:hover { background: rgba(0,212,170,0.03); }

.category-info { display: flex; align-items: center; gap: 14px; }

.category-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.category-name { font-size: 16px; font-weight: 700; }
.category-count { font-size: 12px; color: var(--text-secondary); }

.check-category-body { padding: 0 24px 20px; }

.check-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-radius: 10px;
    margin-bottom: 8px; background: var(--bg-main);
    transition: var(--transition);
}
.check-item:hover { background: #e8ecf1; }

.check-item-text { font-size: 14px; font-weight: 500; flex: 1; }
.check-item-text .critical-badge {
    display: inline-block; font-size: 9px; font-weight: 700;
    background: rgba(255,71,87,0.12); color: var(--danger);
    padding: 2px 8px; border-radius: 4px; margin-left: 8px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.check-toggle { display: flex; gap: 6px; }

.toggle-btn {
    padding: 6px 16px; border-radius: 8px; border: 1.5px solid var(--border);
    background: transparent; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.toggle-btn.yes.active { background: var(--success); color: #fff; border-color: var(--success); }
.toggle-btn.no.active { background: var(--danger); color: #fff; border-color: var(--danger); }
.toggle-btn:not(.active):hover { border-color: var(--text-secondary); }

.temp-input {
    width: 90px; padding: 6px 12px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 14px; font-weight: 600;
    text-align: center; transition: var(--transition);
}
.temp-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,212,170,0.15); }

/* Forms */
.form-control-custom {
    padding: 12px 16px; border: 1.5px solid var(--border);
    border-radius: 10px; font-size: 14px;
    transition: var(--transition); background: var(--bg-card);
}
.form-control-custom:focus {
    border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px rgba(0,212,170,0.12);
}

.form-label-custom { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }

/* Modals */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 20px 24px; }
.modal-header .modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }

/* Login Page */
.login-wrapper {
    min-height: 100vh; display: flex;
    background: var(--bg-dark);
}

.login-left {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(0,212,170,0.1), rgba(0,180,216,0.05));
    position: relative; overflow: hidden;
}

.login-left::before {
    content: ''; position: absolute;
    width: 500px; height: 500px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,170,0.15), transparent);
    top: -100px; right: -100px;
}

.login-left::after {
    content: ''; position: absolute;
    width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, rgba(108,92,231,0.1), transparent);
    bottom: -50px; left: -50px;
}

.login-brand {
    text-align: center; position: relative; z-index: 1;
}

.login-brand .brand-icon {
    width: 90px; height: 90px; border-radius: 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 44px; color: #fff; margin: 0 auto 24px;
    box-shadow: 0 12px 40px rgba(0,212,170,0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-brand h1 {
    font-size: 36px; font-weight: 800; color: #fff;
    margin-bottom: 8px; letter-spacing: -1px;
}

.login-brand p { color: rgba(255,255,255,0.5); font-size: 15px; max-width: 320px; }

.login-features {
    margin-top: 40px; text-align: left;
}

.login-feature {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.login-feature i { color: var(--primary); font-size: 18px; }

.login-right {
    width: 500px; display: flex; align-items: center; justify-content: center;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 30px 0 0 30px;
}

.login-form { width: 100%; max-width: 380px; }

.login-form h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.5px; }
.login-form p { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

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

.login-form .input-icon-wrapper {
    position: relative;
}

.login-form .input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: 18px;
}

.login-form .form-input {
    width: 100%; padding: 14px 16px 14px 44px;
    border: 1.5px solid var(--border); border-radius: 12px;
    font-size: 14px; font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.login-form .form-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}

.login-form .btn-login {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none; border-radius: 12px; color: #fff;
    font-size: 15px; font-weight: 700; cursor: pointer;
    transition: var(--transition); font-family: 'Inter', sans-serif;
}

.login-form .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,212,170,0.35);
}

.login-form .btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* Temperature Log */
.temp-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
    position: relative; overflow: hidden;
}

.temp-status {
    position: absolute; top: 0; right: 0;
    padding: 6px 16px; border-radius: 0 0 0 12px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.temp-status.in-range { background: rgba(46,213,115,0.12); color: var(--success); }
.temp-status.out-range { background: rgba(255,71,87,0.12); color: var(--danger); }

.temp-value { font-size: 36px; font-weight: 800; letter-spacing: -1px; }
.temp-unit { font-size: 16px; font-weight: 500; color: var(--text-secondary); }

/* Empty State */
.empty-state {
    text-align: center; padding: 60px 20px;
}
.empty-state i { font-size: 64px; color: var(--text-light); margin-bottom: 16px; }
.empty-state h4 { font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; }

/* Activity Item */
.activity-item {
    display: flex; gap: 14px; padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 10px; height: 10px; border-radius: 50%;
    margin-top: 5px; flex-shrink: 0;
}
.activity-dot.green { background: var(--success); }
.activity-dot.blue { background: var(--accent); }
.activity-dot.red { background: var(--danger); }
.activity-dot.yellow { background: var(--warning); }

.activity-text { font-size: 13px; color: var(--text-primary); }
.activity-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* Charts */
.chart-container { position: relative; height: 300px; width: 100%; }

/* Loading Spinner */
.spinner-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.85); z-index: 9999;
    justify-content: center; align-items: center;
}
.spinner-overlay.active { display: flex; }

.spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
}

.toast-custom {
    background: var(--bg-card); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 16px 20px;
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 8px; min-width: 320px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
}
.toast-custom.success { border-left-color: var(--success); }
.toast-custom.error { border-left-color: var(--danger); }
.toast-custom.warning { border-left-color: var(--warning); }

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

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
}

@media (max-width: 767.98px) {
    .content-wrapper { padding: 16px; }
    .top-navbar { padding: 0 16px; }
    .stat-value { font-size: 22px; }
    .login-wrapper { flex-direction: column; }
    .login-left { display: none; }
    .login-right { width: 100%; border-radius: 0; min-height: 100vh; }
}

/* Print styles */
@media print {
    .sidebar, .top-navbar, .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .btn, button { display: none !important; }
}
