/* ============================================
   ASTRA GUARD - Mobile-First Modern UI
   Sistem Monitoring Satpam PT Astra
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --primary-dark: #0f2440;
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #06b6d4;
    --info-light: #cffafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }
input, textarea, select { font-family: inherit; font-size: 1rem; }

/* --- Layout --- */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--gray-100);
    position: relative;
    padding-bottom: 80px;
}

.page-content {
    padding: 16px;
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.5s ease-out;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: var(--white);
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    transition: var(--transition);
    font-size: 15px;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    width: 100%;
    border: none;
    cursor: pointer;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
}

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

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    transition: var(--transition);
    border: 1px solid var(--gray-100);
}

.card:active {
    transform: scale(0.99);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
}

.card-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* --- Stats Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--accent);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info { border-left-color: var(--info); }

.stat-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin-top: 4px;
}

/* --- Header --- */
.page-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    padding: 20px 16px;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin: -16px -16px 16px;
}

.page-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.page-header p {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--white);
}

/* --- Shift Badge --- */
.shift-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}

.shift-pagi {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.shift-sore {
    background: linear-gradient(135deg, #fed7aa, #fdba74);
    color: #9a3412;
}

.shift-malam {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #3730a3;
}

/* --- Status Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
}

.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #155e75; }

/* --- List Items --- */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--white);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.list-item-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    border-radius: var(--radius-md);
    font-size: 10px;
    color: var(--gray-400);
    transition: var(--transition);
    position: relative;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 4px;
    background: var(--danger);
    color: var(--white);
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    min-width: 16px;
    text-align: center;
}

/* --- Menu Grid --- */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.menu-item:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.menu-item-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.menu-item-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
    line-height: 1.3;
}

/* --- Photo Upload --- */
.photo-upload {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
}

.photo-upload:active {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
}

.photo-upload.has-image {
    border-style: solid;
    border-color: var(--success);
    padding: 8px;
}

.photo-upload img {
    width: 100%;
    border-radius: var(--radius-md);
    max-height: 200px;
    object-fit: cover;
}

/* --- Section Title --- */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--accent);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-content {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--gray-100);
}

/* --- QR Code --- */
.qr-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.qr-code-image {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    padding: 12px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* --- Ripple Effect --- */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* --- Flash Messages --- */
.flash-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.3s ease-out;
}

.flash-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease-out;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-text {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.modal-actions .btn {
    flex: 1;
}

/* --- Camera View --- */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.camera-container video,
.camera-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-btn {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--white);
    border: 4px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-lg);
}

/* --- Responsive Desktop --- */
@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .menu-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .login-card {
        max-width: 420px;
        padding: 40px 32px;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

/* --- Hidden File Input --- */
input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

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

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    font-weight: 700;
    color: var(--gray-600);
    background: var(--gray-50);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:last-child td {
    border-bottom: none;
}
