/* ===================================
   Minimalist Design System - Variables
   =================================== */

:root {
    /* ==========================================
       PHASE 4: MINIMALIST COLOR SYSTEM
       90% Grayscale + 10% Semantic Colors
       ========================================== */

    /* Primary Color - Single accent color (Teal/Cyan) */
    --primary: #0f766e;           /* Teal-700 - Warm Minimalism */
    --primary-hover: #0d5b54;     /* Teal-800 */
    --primary-light: #f0fdfa;     /* Teal-50 */
    --primary-lighter: #ccfbf1;   /* Teal-100 */

    /* Grayscale System - 90% of UI elements */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;

    /* Semantic Colors - Minimal usage (10% of UI) */
    --success: #059669;           /* Emerald-600 - 翠綠色 */
    --success-hover: #047857;     /* Emerald-700 */
    --success-light: #d1fae5;     /* Emerald-100 */
    --success-bg: #a7f3d0;        /* Emerald-200 */

    --warning: #d97706;           /* Amber-600 */
    --warning-light: #fffbeb;     /* Amber-50 */
    --warning-bg: #fef3c7;        /* Amber-100 */

    --error: #dc2626;             /* Red-600 */
    --error-light: #fef2f2;       /* Red-50 */
    --error-bg: #fee2e2;          /* Red-100 */

    /* Spacing Scale - Based on 8px grid */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */

    /* Border Radius */
    --radius-sm: 0.25rem;  /* 4px */
    --radius-md: 0.375rem; /* 6px */
    --radius-lg: 0.5rem;   /* 8px */
    --radius-xl: 0.75rem;  /* 12px */
    --radius-full: 9999px;

    /* Shadows - Simplified */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Typography - Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;

    /* Typography - Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
}

/* ===================================
   Version Control Styles (Optimized)
   =================================== */

.version-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.version-marker.initial { background-color: var(--gray-500); }
.version-marker.auto { background-color: var(--success); }
.version-marker.named { background-color: var(--primary); }
.version-marker.daily { background-color: var(--warning); }

.badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-initial {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

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

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

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

/* ===================================
   Loading & UI States
   =================================== */

.loading-spinner {
    border: 2px solid var(--gray-100);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   Dropdown Menu (Minimalist)
   =================================== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    min-width: 160px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    color: var(--gray-700);
    font-size: 0.875rem;
    transition: background-color var(--transition-fast);
}

.dropdown-menu a:hover {
    background-color: var(--gray-50);
}

/* ===================================
   Modal (Simplified)
   =================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Reduced opacity for minimalism */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.version-timeline {
    max-height: 60vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .modal {
        padding: var(--space-2);
    }

    .modal-content {
        max-height: 95vh;
    }

    .version-timeline {
        max-height: 65vh;
    }
}

/* ===================================
   Kanban Board (Minimalist Approach)
   =================================== */

.kanban-column {
    transition: border-color var(--transition-base);
    position: relative;
}

/* Simplified drag-over state - no scale, subtle highlight */
.kanban-column.drag-over {
    border-color: var(--primary);
    background-color: rgba(15, 118, 110, 0.03); /* Very subtle Teal background */
}

/* Remove text hint, use top border indicator instead */
.kanban-column.drag-over::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.job-card {
    transition: border-color var(--transition-base);
    cursor: grab;
}

/* Simplified hover - only border change, no shadow or transform */
.job-card:hover {
    border-color: var(--gray-300);
}

.job-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* Empty state styles */
.empty-column {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-style: italic;
    min-height: 120px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #kanban-board {
        grid-template-columns: 1fr;
    }

    .kanban-column {
        min-height: 200px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================
   Button System (3 Variants Only)
   =================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

/* Primary Button - Main actions */
.btn-primary {
    background: var(--primary);
    color: white;
}

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

/* Secondary Button - Secondary actions */
.btn-secondary {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

/* Ghost Button - Minimal actions */
.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

/* ===================================
   Semantic Buttons (Minimal Usage)
   =================================== */

/* Success Button - Success/Confirm actions */
.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover); /* Emerald-700 */
}

/* Warning Button - Warning actions */
.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #b45309; /* Amber-700 */
}

/* Danger Button - Dangerous actions */
.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c; /* Red-700 */
}

/* ===================================
   Button Sizes
   =================================== */

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: 0.8125rem; /* 13px */
}

.btn-md {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem; /* 14px - Default */
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: 1rem; /* 16px */
}

/* Full width button */
.btn-full {
    width: 100%;
}

/* ===================================
   Form Elements (Clean & Minimal)
   =================================== */

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
    transition: border-color var(--transition-base);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

/* ===================================
   Card Component (Minimal)
   =================================== */

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: border-color var(--transition-base);
}

.card:hover {
    border-color: var(--gray-300);
}

/* ===================================
   Utility Classes
   =================================== */

.text-primary { color: var(--primary); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-900 { color: var(--gray-900); }

.bg-primary { background-color: var(--primary); }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }

/* Icon sizing utilities */
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }

/* ===================================
   Navigation Bar (Minimalist)
   =================================== */

nav {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: none !important; /* Remove shadow for minimalism */
}

nav h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

/* User info styling */
#user-info span {
    font-size: 0.875rem;
    color: var(--gray-600);
}

#user-info button {
    font-size: 0.875rem;
    transition: color var(--transition-base);
}

/* ===================================
   Tab Navigation (Clean & Clear)
   =================================== */

.tab-button {
    position: relative;
    padding: var(--space-2) var(--space-1);
    border-bottom: 2px solid transparent;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-500);
    transition: all var(--transition-base);
    background: none;
    cursor: pointer;
}

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

/* Active tab - Clear primary color indicator */
.tab-button.active,
.tab-button[class*="border-blue-500"] {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

/* Remove extra visual noise */
.tab-button:focus {
    outline: none;
}

/* ===================================
   Login Page (Simplified)
   =================================== */

/* Simplify login icon background */
#login-section .bg-blue-600 {
    background: var(--primary);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
}

#login-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

#login-section p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* ===================================
   Alert Component (Minimalist)
   =================================== */

#alert-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 50;
}

#alert-message {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid;
}

/* Alert variants - Minimalist colors */
#alert-message.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

#alert-message.alert-error {
    background-color: var(--error-light);
    color: var(--error);
    border-color: var(--error);
}

#alert-message.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border-color: var(--warning);
}

#alert-message.alert-info {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ===================================
   Table Styles (Clean & Readable)
   =================================== */

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

thead {
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

thead th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background-color var(--transition-fast);
}

tbody tr:hover {
    background-color: var(--gray-50);
}

tbody td {
    padding: var(--space-4);
    font-size: 0.875rem;
    color: var(--gray-900);
}

/* Simplified table - no heavy borders */
table,
th,
td {
    border: none;
}

/* ===================================
   Phase 3: Typography Refinement
   =================================== */

/* Global typography improvements */
body {
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    line-height: var(--leading-tight);
    font-weight: var(--font-semibold);
}

p {
    line-height: var(--leading-relaxed);
}

/* ===================================
   Phase 3: Empty State Design
   =================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-4);
    text-align: center;
    color: var(--gray-400);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    color: var(--gray-300);
}

.empty-state-title {
    font-size: 1rem;
    font-weight: var(--font-medium);
    color: var(--gray-600);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: 0.875rem;
    color: var(--gray-400);
    line-height: var(--leading-relaxed);
}

/* ===================================
   Phase 3: Loading States
   =================================== */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
}

.loading-text {
    margin-top: var(--space-3);
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Skeleton loaders */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-100) 0%,
        var(--gray-50) 50%,
        var(--gray-100) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: var(--space-3);
}

/* ===================================
   Phase 3: Responsive Spacing
   =================================== */

/* Mobile-first responsive spacing */
@media (max-width: 640px) {
    /* Reduce padding on mobile */
    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
    
    /* Smaller card padding */
    .card {
        padding: var(--space-4);
    }
    
    /* Compact button padding */
    .btn {
        padding: var(--space-2) var(--space-3);
    }
    
    /* Increase touch targets */
    button,
    a[role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Stack navigation on mobile */
    nav h1 {
        font-size: 1rem;
    }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    .card {
        padding: var(--space-5);
    }
}

/* ===================================
   Phase 3: Animation Cleanup
   =================================== */

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Remove unnecessary transitions */
* {
    transition-property: none;
}

/* Only transition specific properties that enhance UX */
.btn,
.tab-button,
.job-card,
.kanban-column,
input,
select,
textarea {
    transition-property: background-color, border-color, color, opacity;
    transition-duration: var(--transition-base);
    transition-timing-function: ease;
}

/* ===================================
   Phase 3: Focus States (A11y)
   =================================== */

/* Consistent focus indicators */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===================================
   Phase 3: Utility Enhancements
   =================================== */

/* Line height utilities */
.leading-tight { line-height: var(--leading-tight); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* Font weight utilities */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }

/* Truncation utility */
.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;
}
