/* ===================================================================
   CONSTRUCTION COST TRACKER - STYLES
   ================================================================ */

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

:root {
    --primary: #3b82f6;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f3f4f6;
    --dark: #1f2937;
    --white: #ffffff;
    
    --blue: #3b82f6;
    --green: #10b981;
    --red: #ef4444;
    --orange: #f59e0b;
    --purple: #8b5cf6;
    --gray: #6b7280;
    
    --border-radius: 0.75rem;
    --box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.logo p {
    font-size: 0.875rem;
    color: var(--secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.project-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--white);
    cursor: pointer;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary);
}

.user-menu i {
    font-size: 1.5rem;
}

/* Navigation */
.nav {
    background: var(--white);
    border-bottom: 1px solid #e5e7eb;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-item {
    padding: 1rem 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--secondary);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--dark);
    border-color: #d1d5db;
}

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

.nav-item i {
    margin-right: 0.5rem;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.view-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: #dbeafe; color: var(--blue); }
.stat-icon.green { background: #d1fae5; color: var(--green); }
.stat-icon.red { background: #fee2e2; color: var(--red); }
.stat-icon.purple { background: #ede9fe; color: var(--purple); }

.stat-content p {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.stat-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-content small {
    font-size: 0.75rem;
    color: var(--secondary);
}

/* Card */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.overview-grid .label {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.overview-grid .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.overview-grid .value.orange { color: var(--orange); }
.overview-grid .value.red { color: var(--red); }

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.charts-grid .card {
    min-height: 350px;
}

.charts-grid canvas {
    max-height: 280px;
}

/* Issues List */
.issue-item {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.issue-item:last-child {
    border-bottom: none;
}

.issue-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.issue-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--secondary);
}

.issue-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.issue-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--secondary);
    flex-wrap: wrap;
}

.issue-card {
    margin-bottom: 1rem;
}

.issue-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.issue-card p {
    color: var(--secondary);
    margin-bottom: 1rem;
}

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

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #e5e7eb; color: #374151; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #cffafe; color: #164e63; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: #2563eb;
}

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

.btn-icon {
    padding: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
}

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

.btn-danger:hover {
    background: #fee2e2;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.filter-select {
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--white);
    cursor: pointer;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secondary);
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table .orange {
    color: var(--orange);
}

.data-table .red {
    color: var(--red);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

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

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
}

/* Forms */
form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
}

.form-actions button {
    flex: 1;
}

/* Progress Bar */
.progress-item {
    margin-bottom: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* Variance Item */
.variance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.variance-cost {
    text-align: right;
}

.variance-cost .red {
    font-weight: 700;
    color: var(--red);
}

.variance-cost .small {
    font-size: 0.75rem;
    color: var(--secondary);
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner i {
    font-size: 3rem;
    color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--dark);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--box-shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 10000;
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

.toast-info {
    background: var(--info);
}

/* Utility Classes */
.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--secondary);
}

.red { color: var(--red); }
.green { color: var(--green); }
.orange { color: var(--orange); }
.blue { color: var(--blue); }

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-list {
        gap: 1rem;
        overflow-x: auto;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}
