/* Premium Glassmorphism UI - CSS */

:root {
    /* Colors */
    --primary: #1a7373;
    --primary-light: #2c9797;
    --primary-dark: #104b4b;
    --secondary: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(226, 232, 240, 0.8);
    --bg-mesh: linear-gradient(135deg, #f0f4f8 0%, #e0f2f1 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --success: #10b981;
    --danger: #ef4444;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    
    /* Radii */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Animation */
    --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;
    color: var(--text-main);
    background: var(--bg-mesh);
    min-height: 100vh;
    line-height: 1.5;
}

/* Glassmorphism utility */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-glass);
}

/* Typography & Utils */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-semibold { font-weight: 600; }
.text-gray-700 { color: #334155; }
.text-primary { color: var(--primary); }
.mt-6 { margin-top: 1.5rem; }

/* ---------------- Layout ---------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid var(--glass-border);
    z-index: 50;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.15);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 3rem;
}

.main-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
    background-color: #1a7373 !important;
    color: white;
}
.sidebar-header {
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white !important;
}
.logo-icon { color: white !important; font-size: 1.75rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255,255,255,0.1) !important;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: white !important;
}

.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.2); color: white;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 0.95rem; color: white !important; }
.user-role { font-size: 0.8rem; color: rgba(255,255,255,0.7) !important; }

/* Navigation */
.nav-links.vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.nav-links.vertical::-webkit-scrollbar {
    width: 4px;
}

.nav-links.vertical::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.nav-links.vertical::-webkit-scrollbar-track {
    background: transparent;
}

.nav-item, .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-item-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.nav-item:hover, .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.dropdown.active .dropdown-toggle {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    font-weight: 600;
}

.dropdown-menu {
    display: none;
    flex-direction: column;
    padding-left: 2.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.dropdown-menu.show {
    display: flex;
    animation: slideDown 0.3s ease-out forwards;
}

.dropdown-menu a {
    padding: 0.5rem 1rem;
    color: rgba(255, 255, 255, 0.7) !important;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
}

.dropdown-menu a:hover {
    color: white !important;
    background: rgba(255,255,255,0.1) !important;
}

.dropdown-menu a.active {
    color: white !important;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1) !important;
}

.dropdown-menu a.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.logout-btn { color: #fca5a5 !important; }
.logout-btn:hover { background: rgba(239, 68, 68, 0.2) !important; color: white !important; }

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


/* ---------------- Main Content ---------------- */

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Cards */
.card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 i {
    color: var(--primary);
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.form-group label i {
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: #fff;
}

.form-control[readonly] {
    background: rgba(241, 245, 249, 0.6);
    color: var(--text-muted);
    cursor: not-allowed;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.kpp-table th {
    text-align: left;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.6);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.kpp-table th.text-center { text-align: center; }

.kpp-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    transition: var(--transition);
}

.kpp-table tr:hover td {
    background: rgba(248, 250, 252, 0.6);
}

.kpp-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #0f172a;
}

.kpp-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Input inside table */
.input-with-suffix {
    position: relative;
}

.weight-input {
    width: 100%;
    padding-right: 0.5rem;
}

.uom-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.total-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    width: 100%;
    transition: var(--transition);
}

.total-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.total-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Custom Checkbox */
.custom-checkbox {
    display: inline-block;
    position: relative;
    padding-left: 24px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: rgba(255,255,255,0.8);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: var(--primary-light);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Actions */
.actions-container {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: none;
}

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

.btn-secondary:hover {
    background: var(--secondary);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.39);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Modal & Review Details */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.show .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.8);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: rgba(248, 250, 252, 0.8);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.39);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.39);
}

/* Timeline */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 2rem 0;
    padding: 1rem 0;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    height: 100%;
    width: 2px;
    background: var(--border-color);
}
.timeline-item {
    position: relative;
    padding-left: 3.5rem;
    margin-bottom: 2rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-icon {
    position: absolute;
    left: 4px;
    top: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-color, #fff);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
    z-index: 2;
}
.timeline-item.completed .timeline-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}
.timeline-item.active .timeline-icon {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}
.timeline-item.rejected .timeline-icon {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}
.timeline-content {
    background: rgba(255, 255, 255, 0.7);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.timeline-title { font-weight: 600; color: var(--text-main); margin-bottom: 0.25rem; }
.timeline-desc { font-size: 0.9rem; color: var(--text-muted); }
.timeline-date { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; display: block;}
