/**
 * Stylesheet untuk Sistem Presensi Karyawan
 * PT Lestari Bumi Persada
 * 
 * Design yang sama dengan versi Next.js
 */

/* ========================================
   CSS Variables / Design Tokens
   ======================================== */
:root {
    /* Colors */
    --background: #f8faf8;
    --foreground: #1a2e1a;
    --card: #ffffff;
    --card-foreground: #1a2e1a;
    --popover: #ffffff;
    --popover-foreground: #1a2e1a;
    --primary: #2d6a4f;
    --primary-foreground: #f8faf8;
    --secondary: #e8f0e8;
    --secondary-foreground: #2d4a2d;
    --muted: #e8f0e8;
    --muted-foreground: #5a7a5a;
    --accent: #c9a227;
    --accent-foreground: #1a2e1a;
    --destructive: #dc3545;
    --destructive-foreground: #ffffff;
    --border: #d4e4d4;
    --input: #e0ebe0;
    --ring: #2d6a4f;
    
    /* Status Colors */
    --success: #28a745;
    --success-foreground: #ffffff;
    --warning: #d9a406;
    --warning-foreground: #1a2e1a;
    
    /* Sidebar */
    --sidebar: #1a2e1a;
    --sidebar-foreground: #f0f5f0;
    --sidebar-primary: #3d8a6f;
    --sidebar-primary-foreground: #f8faf8;
    --sidebar-accent: #2d4a3d;
    --sidebar-accent-foreground: #f0f5f0;
    --sidebar-border: #3d5a4d;
    
    /* Radius */
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    
    /* Fonts */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
}

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

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

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--foreground);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted {
    color: var(--muted-foreground);
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-center {
    text-align: center;
}

.font-mono {
    font-family: var(--font-mono);
}

/* ========================================
   Layout
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

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

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 1.5rem;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background-color: var(--sidebar);
    color: var(--sidebar-foreground);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(61, 138, 111, 0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-primary);
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sidebar-foreground);
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: rgba(240, 245, 240, 0.6);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

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

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(240, 245, 240, 0.8);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
}

.sidebar-nav a svg {
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--sidebar-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(240, 245, 240, 0.6);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: rgba(240, 245, 240, 0.8);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--destructive);
}

/* ========================================
   Cards
   ======================================== */
.card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-description {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

.card-content {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background-color: var(--muted);
}

.card-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.card-primary .card-header {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #245840;
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover:not(:disabled) {
    background-color: #d8e8d8;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--foreground);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--muted);
}

.btn-destructive {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-destructive:hover:not(:disabled) {
    background-color: #c82333;
}

.btn-ghost {
    background-color: transparent;
    color: var(--foreground);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--muted);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.625rem;
}

.btn-block {
    width: 100%;
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--card);
    color: var(--foreground);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--muted-foreground);
}

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

.form-input-icon svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    width: 1rem;
    height: 1rem;
}

.form-input-icon input {
    padding-left: 2.5rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--destructive);
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.badge-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-success {
    background-color: var(--success);
    color: var(--success-foreground);
}

.badge-warning {
    background-color: var(--warning);
    color: var(--warning-foreground);
}

.badge-destructive {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

.badge-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--muted-foreground);
}

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

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

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 500;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background-color: var(--muted);
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 1rem;
}

.alert svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-info {
    background-color: rgba(45, 106, 79, 0.1);
    border-color: rgba(45, 106, 79, 0.2);
    color: var(--primary);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.alert-warning {
    background-color: rgba(217, 164, 6, 0.1);
    border-color: rgba(217, 164, 6, 0.2);
    color: var(--warning);
}

.alert-destructive {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2);
    color: var(--destructive);
}

/* ========================================
   Avatar
   ======================================== */
.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    background-color: rgba(45, 106, 79, 0.1);
    color: var(--primary);
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
}

/* ========================================
   Stats Cards
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ========================================
   Modal / Dialog
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

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

.modal {
    background-color: var(--card);
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--muted-foreground);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* ========================================
   Tabs
   ======================================== */
.tabs-list {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-button {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

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

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   Login Page
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

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

.login-logo {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background-color: rgba(45, 106, 79, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--muted-foreground);
}

.demo-accounts {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.demo-accounts h4 {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
    margin-bottom: 0.75rem;
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.demo-item {
    padding: 0.75rem;
    background-color: var(--muted);
    border-radius: var(--radius-sm);
}

.demo-item strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.demo-item span {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ========================================
   Time Display
   ======================================== */
.time-display {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.time-display-sm {
    font-size: 2.5rem;
}

.time-mono {
    font-family: var(--font-mono);
}

/* ========================================
   Camera Capture
   ======================================== */
.camera-container {
    max-width: 400px;
    margin: 0 auto;
}

.camera-preview {
    position: relative;
    aspect-ratio: 4/3;
    background-color: var(--muted);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-preview.mirror video {
    transform: scaleX(-1);
}

.camera-guide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.camera-guide-circle {
    width: 12rem;
    height: 12rem;
    border: 2px solid rgba(45, 106, 79, 0.5);
    border-radius: 50%;
}

.camera-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: var(--card);
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--border);
    border-top: none;
}

.camera-btn-capture {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state svg {
    width: 3rem;
    height: 3rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--muted-foreground);
}

/* ========================================
   Grid Utilities
   ======================================== */
.grid {
    display: grid;
    gap: 1rem;
}

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

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

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Flex Utilities
   ======================================== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* ========================================
   Spacing Utilities
   ======================================== */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* ========================================
   Border Utilities
   ======================================== */
.border {
    border: 1px solid var(--border);
}

.border-dashed {
    border-style: dashed;
}

.border-primary {
    border-color: var(--primary);
}

.border-success {
    border-color: var(--success);
}

.rounded {
    border-radius: var(--radius);
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: 9999px;
}

/* ========================================
   Background Utilities
   ======================================== */
.bg-muted {
    background-color: var(--muted);
}

.bg-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.bg-success\/10 {
    background-color: rgba(40, 167, 69, 0.1);
}

.bg-warning\/10 {
    background-color: rgba(217, 164, 6, 0.1);
}

.bg-destructive\/10 {
    background-color: rgba(220, 53, 69, 0.1);
}

.bg-primary\/10 {
    background-color: rgba(45, 106, 79, 0.1);
}

/* ========================================
   Text Colors
   ======================================== */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-destructive {
    color: var(--destructive);
}

.text-primary {
    color: var(--primary);
}

/* ========================================
   Animation
   ======================================== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   Loading State
   ======================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

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

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .hide-mobile {
        display: none;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
    
    .mobile-overlay {
        display: none;
    }
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: none;
}

.mobile-overlay.active {
    display: block;
}

/* ========================================
   Truncate
   ======================================== */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
