/* BuildFlow IQ - Modern Construction Platform CSS */
:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --white: #ffffff;
    --gray: #95a5a6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
    background: #f5f7fa;
    color: var(--dark);
    line-height: 1.6;
}

/* Modern Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--light);
}

.sidebar-header h3 {
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav-item {
    padding: 0.75rem 1.5rem;
    margin: 0.25rem 0;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--secondary);
}

.sidebar-nav-item:hover {
    background: var(--light);
    color: var(--primary);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

/* Top Bar */
.top-bar {
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--light);
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
}

.card-body {
    padding: 1.5rem;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--white), #ffffff);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-top: 0.5rem;
}

.stat-label {
    color: var(--gray);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(44, 62, 80, 0.3);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--light);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light);
}

.table tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
}

/* Progress Bar */
.progress {
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    transition: width 0.3s;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Estimate Builder Specific */
.estimate-builder {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.estimate-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--light);
    align-items: center;
}

.estimate-item-header {
    background: var(--light);
    font-weight: 600;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    padding: 1rem;
    min-width: 300px;
    z-index: 3000;
    animation: slideInRight 0.3s;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Tables */
@media (max-width: 768px) {
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem;
    }
}