:root {
    --primary-color: #03787c;
    --primary-hover: #025f62;
    --secondary-color: #014446;
    --accent-color: #00d1b2;
    --bg-color: #f5f8fa;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 260px;
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    background-image: linear-gradient(135deg, #f5f8fa 0%, #e0f2f1 100%);
    color: var(--text-main);
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(3, 120, 124, 0.3);
}

.logo-area h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(3, 120, 124, 0.1), rgba(0, 209, 178, 0.1));
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(3, 120, 124, 0.2);
}

/* Views */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

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

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.normal {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.issue {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-icon.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-info h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Analytics Rankings */
@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr !important;
    }
}

.ranking-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}
.ranking-list-item:last-child {
    border-bottom: none;
}
.ranking-name {
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}
.ranking-count {
    background: rgba(3, 120, 124, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Recent Inspections Table */
.recent-inspections {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 4px 12px rgba(3, 120, 124, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(3, 120, 124, 0.4);
    transform: translateY(-2px);
}

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

.btn-outline:hover {
    background: #f1f5f9;
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.95rem;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge.severity-high { background: #ef4444; color: #fff; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4); }
.badge.severity-low { background: #f59e0b; color: #fff; }

/* Form Styles */
.inspection-form {
    max-width: 900px;
    margin: 0 auto;
}

.form-header {
    margin-bottom: 2rem;
    text-align: center;
}

.form-header h2 {
    color: var(--secondary-color);
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.form-header p {
    color: var(--text-muted);
}

.form-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(to right, rgba(3, 120, 124, 0.05), transparent);
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.required {
    color: var(--danger);
}

input[type="text"], input[type="password"], input[type="date"], input[type="file"], select, textarea {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(3, 120, 124, 0.15);
    background: #fff;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

/* Category Dividers */
.category-divider {
    margin: 3.5rem 0 2rem 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}
.category-divider:first-child {
    margin-top: 0;
}
.category-divider h4 {
    color: var(--secondary-color);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
}
.category-divider i {
    color: var(--primary-color);
}
.category-image {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.category-image:hover img {
    transform: scale(1.05);
}

/* Radio Cards */
.check-item {
    margin-bottom: 1.8rem;
    padding-bottom: 1.8rem;
    border-bottom: 1px dashed var(--border-color);
}

.check-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.check-title {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.radio-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.radio-card:hover .card-content {
    background: #f1f5f9;
}

.radio-card input:checked ~ .card-content {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.radio-card.danger input:checked ~ .card-content {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.radio-card.warning input:checked ~ .card-content {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

/* Issue Details */
.issue-details {
    display: none;
    margin-top: 1rem;
    padding: 1.25rem;
    background: rgba(239, 68, 68, 0.05);
    border: 1px dashed var(--danger);
    border-radius: 8px;
    animation: slideDown 0.3s ease-out;
}

.issue-details.visible {
    display: block;
}

.issue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.mt-4 { margin-top: 1rem; }

/* Modals */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    animation: zoomIn 0.3s ease;
}

.report-modal-content {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: var(--secondary-color);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-close:hover { color: var(--danger); }

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Report Print Area inside Modal */
#report-print-area {
    padding: 20px;
    background: white;
}

.report-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
}

.report-item {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.report-item strong {
    display: block;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #report-print-area, #report-print-area * {
        visibility: visible;
    }
    #report-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .hide-on-print {
        display: none !important;
    }
}

/* Responsive Styles */

/* Tablet (Max 1024px) */
@media (max-width: 1024px) {
    .grid-2, .issue-grid, .report-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile (Max 768px) */
@media (max-width: 768px) {
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .app-container {
        flex-direction: column;
    }

    /* Bottom Navigation Bar */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0.5rem 0;
        border-right: none;
        border-top: 1px solid rgba(0,0,0,0.1);
        z-index: 1000;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
    }
    
    .logo-area { 
        display: none; 
    }
    
    .nav-menu { 
        flex-direction: row; 
        width: 100%;
        justify-content: space-around;
        align-items: center;
        gap: 0;
    }

    .nav-menu > div {
        margin-top: 0 !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .nav-item {
        flex-direction: column;
        padding: 8px 4px;
        font-size: 0.75rem;
        border-radius: 8px;
        gap: 4px;
        text-align: center;
        border-left: none !important;
        flex: 1;
    }
    
    .nav-item.active {
        border-left: none;
        border-bottom: 3px solid var(--primary-color) !important;
        background: transparent;
        color: var(--primary-color);
    }
    
    .nav-item i {
        font-size: 1.5rem;
        margin-bottom: 2px;
    }
    
    #btn-logout span {
        display: none; 
    }
    
    .main-content { 
        margin-left: 0; 
        margin-bottom: 75px; 
        padding: 1.5rem 1rem; 
        width: 100%;
        max-width: 100vw;
    }
    
    /* Header */
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-profile {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* Stats & Grids */
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .radio-group { 
        grid-template-columns: 1fr; 
    }
    
    .header-actions { 
        flex-direction: column; 
        width: 100%; 
    }
    
    .header-actions .btn { 
        width: 100%; 
        justify-content: center; 
    }
    
    .section-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 1rem; 
    }

    /* Form specific */
    .form-card {
        margin-bottom: 1.5rem;
    }
    
    .category-image {
        height: 140px;
    }

    /* Modal adjustments */
    .modal-content {
        padding: 1.5rem;
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 85vh;
        overflow-y: auto;
    }
    
    #manage-belt-modal .modal-content > div:nth-child(2) {
        grid-template-columns: 1fr !important; 
        gap: 20px;
    }
    
    .report-modal-content {
        padding: 1rem;
    }

    .data-table th, .data-table td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Very Small Mobile */
@media (max-width: 480px) {
    .nav-item span {
        display: none; 
    }
    .stat-card {
        padding: 1.2rem;
        gap: 1rem;
    }
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    .stat-value {
        font-size: 1.5rem;
    }
    .header-title h1 {
        font-size: 1.5rem;
    }
    .input-with-btn {
        flex-direction: column;
    }
    .input-with-btn .btn {
        width: 100%;
    }
}
