/* ===== CSS Variables - SiteTime Theme ===== */
:root {
    --bg-cream: #fdf6f0;
    --bg-dark: #1e293b;
    --header-orange: #ea580c;
    --btn-orange: #c2410c;
    --btn-orange-hover: #a73609;
    --green-primary: #10b981;
    --green-light: #d1fae5;
    --green-dark: #065f46;
    --orange-finish: #ea580c;
    --red-danger: #dc2626;
    --text-dark: #1c1917;
    --text-medium: #57534e;
    --text-muted: #78716c;
    --text-light: #a8a29e;
    --border-light: rgba(168, 162, 158, 0.4);
    --card-bg: rgba(255, 255, 255, 0.55);
    --card-border: rgba(255, 255, 255, 0.8);
    --input-bg: rgba(255, 255, 255, 0.7);
    --shadow: 0 4px 20px rgba(44, 42, 38, 0.1);
    --radius: 12px;
    --radius-lg: 20px;
  }
  
  /* ===== Reset & Base ===== */
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  body {
    background: var(--bg-cream);
    color: var(--text-dark);
  }
  
  /* ===== Utility Classes ===== */
  .hidden {
    display: none !important;
  }
  
  /* ===== Alert Styles ===== */
  #alert-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 400px;
  }
  
  .alert {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid;
    margin-bottom: 10px;
    text-align: center;
    animation: slideIn 0.3s ease;
  }
  
  .alert-error {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
  }
  
  .alert-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #047857;
  }
  
  .alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
  }
  
  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
  }
  
  /* ===== Screen Layout ===== */
  .screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
  
  /* ===== Loading Screen ===== */
  #loading-screen {
    background: var(--bg-cream);
    justify-content: center;
    align-items: center;
  }
  
  .loading-content {
    text-align: center;
  }
  
  .app-name {
    font-size: 38px;
    font-weight: 300;
    color: #292524;
    letter-spacing: 2px;
    margin-bottom: 20px;
  }
  
  .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--btn-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  
  /* ===== Login Screen ===== */
  #login-screen, #create-account-screen {
    background: var(--bg-cream);
    justify-content: center;
    align-items: center;
    padding: 24px;
  }
  
  .login-container {
    width: 100%;
    max-width: 340px;
    text-align: center;
  }
  
  .subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 30px;
  }
  
  .login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
  }
  
  .input-group {
    margin-bottom: 18px;
    text-align: left;
  }
  
  .input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 8px;
    margin-left: 4px;
  }
  
  .input-group input {
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px;
    font-size: 16px;
    background: var(--input-bg);
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  
  .input-group input:focus {
    outline: none;
    border-color: var(--btn-orange);
    box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.1);
  }
  
  .input-group input::placeholder {
    color: var(--text-light);
  }
  
  .input-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 4px;
  }
  
  .input-hint.success {
    color: var(--green-primary);
  }
  
  /* ===== Buttons ===== */
  .btn {
    display: block;
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
  }
  
  .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
  }
  
  .btn-primary {
    background: var(--btn-orange);
    color: white;
    margin-top: 12px;
  }
  
  .btn-primary:hover:not(:disabled) {
    background: var(--btn-orange-hover);
  }
  
  .btn-secondary {
    background: rgba(255, 255, 255, 0.6);
    color: #44403c;
    border: 1px solid rgba(168, 162, 158, 0.3);
    margin-top: 12px;
  }
  
  .btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.8);
  }
  
  .btn-clock-in {
    background: var(--green-primary);
    color: white;
    margin-top: 10px;
  }
  
  .btn-clock-in:hover:not(:disabled) {
    background: #0d9668;
  }
  
  .btn-finish {
    background: var(--orange-finish);
    color: white;
    margin-bottom: 10px;
  }
  
  .btn-finish:hover:not(:disabled) {
    background: #dc4c05;
  }
  
  .btn-end-day {
    background: var(--red-danger);
    color: white;
  }
  
  .btn-end-day:hover:not(:disabled) {
    background: #b91c1c;
  }
  
  .btn-logout {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    margin-top: 30px;
    font-size: 14px;
    font-weight: 500;
  }
  
  .btn-logout:hover:not(:disabled) {
    background: #f9fafb;
  }
  
  .btn-danger {
    background: var(--red-danger);
    color: white;
  }
  
  .btn-danger:hover:not(:disabled) {
    background: #b91c1c;
  }
  
  /* Create Account Link */
  .create-account-link {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
  }
  
  .create-account-link a {
    color: var(--btn-orange);
    font-weight: 600;
    text-decoration: none;
  }
  
  .create-account-link a:hover {
    text-decoration: underline;
  }
  
  /* ===== Main App Screen ===== */
  #main-screen {
    background: var(--bg-dark);
  }
  
  .app-header {
    background: var(--header-orange);
    padding: 60px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .header-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
  }
  
  .header-left p {
    font-size: 12px;
    color: #fed7aa;
  }
  
  .header-right {
    text-align: right;
  }
  
  .time-display {
    font-size: 28px;
    font-weight: 700;
    color: white;
  }
  
  .total-display {
    font-size: 12px;
    color: #fed7aa;
    margin-top: 4px;
  }
  
  .app-content {
    flex: 1;
    background: white;
    padding: 20px;
    min-height: calc(100vh - 120px);
  }
  
  /* ===== Active Job Card ===== */
  .active-job-card {
    background: var(--green-light);
    border: 2px solid var(--green-primary);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
  }
  
  .active-job-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .active-job-left {
    flex: 1;
  }
  
  .active-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 8px;
  }
  
  .pulsing-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green-primary);
    animation: pulse 2s infinite;
  }
  
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
  
  .job-address {
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
  }
  
  .job-start-time {
    font-size: 11px;
    color: #6b7280;
  }
  
  .active-job-right {
    text-align: right;
  }
  
  .duration-label {
    display: block;
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 2px;
  }
  
  .duration-value {
    font-size: 24px;
    font-weight: 700;
    color: #059669;
  }
  
  /* ===== Clock In Form ===== */
  .clock-in-form .input-group label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
  }
  
  .clock-in-form .input-group input {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
  }
  
  .clock-in-form .input-group input:focus {
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  }
  
  /* ===== Address Autocomplete ===== */
  .autocomplete-container {
    position: relative;
  }
  
  .suggestions-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
  }
  
  .suggestion-item {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background 0.2s;
  }
  
  .suggestion-item:last-child {
    border-bottom: none;
  }
  
  .suggestion-item:hover {
    background: #f9fafb;
  }
  
  /* ===== History Section ===== */
  .history-section {
    margin-top: 30px;
  }
  
  .history-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
  }
  
  .history-item {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .history-item-left {
    flex: 1;
  }
  
  .history-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 4px;
  }
  
  .history-item-address {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
  }
  
  .history-item-time {
    font-size: 11px;
    color: #9ca3af;
  }
  
  .history-item-duration {
    font-size: 18px;
    font-weight: 700;
    color: var(--orange-finish);
  }
  
  .total-section {
    background: #fff7ed;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid var(--orange-finish);
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .total-section span:first-child {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
  }
  
  .day-total {
    font-size: 24px;
    font-weight: 700;
    color: var(--orange-finish);
  }
  
  /* ===== Camera Modal ===== */
  .modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .camera-container {
    width: 100%;
    height: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    background: black;
  }
  
  .camera-header {
    text-align: center;
    padding: 20px;
    color: white;
  }
  
  .camera-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
  }
  
  .camera-header p {
    font-size: 14px;
    color: #9ca3af;
  }
  
  .camera-wrapper {
    flex: 1;
    margin: 0 20px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: #1a1a1a;
  }
  
  #camera-video, #photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  #camera-canvas {
    display: none;
  }
  
  .face-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 260px;
    border-radius: 100px;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    pointer-events: none;
  }
  
  .camera-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
  }
  
  .btn-camera-cancel {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 15px;
  }
  
  .btn-capture {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .capture-inner {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: white;
    border: 4px solid black;
  }
  
  .spacer {
    width: 60px;
  }
  
  .preview-controls {
    display: flex;
    gap: 15px;
    padding: 20px;
  }
  
  .btn-retake {
    flex: 1;
    background: #374151;
    color: white;
  }
  
  .btn-confirm {
    flex: 2;
    background: var(--green-primary);
    color: white;
  }
  
  .btn-confirm:hover:not(:disabled) {
    background: #0d9668;
  }
  
  .btn-preview-cancel {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    padding: 20px;
    width: 100%;
  }
  
  /* ===== Logout Modal ===== */
  #logout-modal .modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--radius);
    text-align: center;
    max-width: 400px;
    margin: 20px;
  }
  
  #logout-modal h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
  }
  
  #logout-modal p {
    color: #6b7280;
    margin-bottom: 24px;
  }
  
  .modal-buttons {
    display: flex;
    gap: 12px;
  }
  
  .modal-buttons .btn {
    flex: 1;
  }
  
  /* ===== Responsive ===== */
  @media (max-width: 480px) {
    .app-header {
      padding: 40px 16px 16px;
    }
    
    .header-left h2 {
      font-size: 18px;
    }
    
    .time-display {
      font-size: 24px;
    }
    
    .app-content {
      padding: 16px;
    }
    
    .camera-controls {
      padding: 20px;
    }
    
    .btn-capture {
      width: 70px;
      height: 70px;
    }
    
    .capture-inner {
      width: 55px;
      height: 55px;
    }
  }
  
  /* ===== Loading State for Buttons ===== */
  .btn.loading {
    position: relative;
    color: transparent;
  }
  
  .btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }