/* ═══════════════════════════════════════════════
   ATZALA CONSTRUCTION LLC — Application Styles
   Brand Colors: Red #D32F2F, Dark Gray #2D2D2D
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&family=Barlow+Condensed:wght@400;500;600;700&display=swap');

:root {
    --red-primary: #D32F2F;
    --red-dark: #B71C1C;
    --red-light: #EF5350;
    --red-glow: rgba(211, 47, 47, 0.15);
    --dark-bg: #0F0F0F;
    --dark-surface: #1A1A1A;
    --dark-card: #222222;
    --dark-elevated: #2A2A2A;
    --dark-border: #333333;
    --gray-500: #6B6B6B;
    --gray-400: #8A8A8A;
    --gray-300: #A0A0A0;
    --gray-200: #C0C0C0;
    --text-primary: #F0F0F0;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;
    --success: #43A047;
    --warning: #FB8C00;
    --info: #1E88E5;
    --danger: #E53935;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Barlow', sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT ─── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--dark-surface);
    border-right: 1px solid var(--dark-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--dark-border);
    text-align: center;
}

.sidebar-logo img {
    width: 160px;
    height: auto;
}

.sidebar-logo h2 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--red-primary);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 16px 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--dark-elevated);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--red-glow);
    color: var(--red-primary);
    font-weight: 600;
}

.nav-link .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.nav-badge {
    margin-left: auto;
    background: var(--red-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

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

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--red-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}
.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--red-primary);
}
.emp-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.emp-photo-lg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--red-primary);
}
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
}

/* ─── MOBILE TOGGLE ─── */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 90;
}

/* ─── PAGE HEADER ─── */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-header .subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── CARDS ─── */
.card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 24px;
}

/* ─── STAT CARDS ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--red-primary);
}

.stat-card .stat-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ─── TABLES ─── */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

thead th {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--dark-border);
    white-space: nowrap;
}

tbody td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--dark-border);
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--dark-elevated);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ─── FORMS ─── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px var(--red-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

input[type="time"].form-control {
    padding: 10px 12px;
}

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--dark-elevated);
    color: var(--text-primary);
    border: 1px solid var(--dark-border);
}

.btn-secondary:hover {
    background: var(--dark-border);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

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

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

.btn-success:hover {
    background: #388E3C;
}

/* ─── NOTIFICATIONS ─── */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--dark-border);
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--dark-elevated);
}

.notification-item.unread {
    border-left: 3px solid var(--red-primary);
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red-primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── PROJECT CARDS ─── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--red-primary), var(--red-light));
    opacity: 0;
    transition: opacity 0.25s;
}

.project-card:hover {
    border-color: var(--red-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.project-card:hover::after {
    opacity: 1;
}

.project-card h4 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.project-card .project-address {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.project-card .project-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ─── BADGES ─── */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(67, 160, 71, 0.15);
    color: var(--success);
}

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

/* ─── MODAL ─── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--dark-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ─── LOGIN PAGE ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(211,47,47,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(211,47,47,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

.login-card .logo-section {
    text-align: center;
    margin-bottom: 36px;
}

.login-card .logo-section img {
    width: 180px;
    height: auto;
    margin-bottom: 12px;
}

.login-card .logo-section h1 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.login-error {
    background: rgba(229, 57, 53, 0.1);
    border: 1px solid rgba(229, 57, 53, 0.3);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
}

/* ─── ALERTS / TOASTS ─── */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(229, 57, 53, 0.1);
    border: 1px solid rgba(229, 57, 53, 0.3);
    color: var(--danger);
}

.alert-success {
    background: rgba(67, 160, 71, 0.1);
    border: 1px solid rgba(67, 160, 71, 0.3);
    color: var(--success);
}

/* ─── FILTERS BAR ─── */
.filters-bar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filters-bar .form-group {
    margin-bottom: 0;
    min-width: 180px;
}

/* ─── INLINE FORM ROW ─── */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

/* ─── ASSIGNMENT CHIPS ─── */
.assignment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--dark-elevated);
    border: 1px solid var(--dark-border);
    border-radius: 20px;
    font-size: 13px;
    margin: 4px;
}

.assignment-chip .remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
}

.assignment-chip .remove-btn:hover {
    color: var(--danger);
}

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
    }

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

    .main-content {
        margin-left: 0;
        padding: 24px 16px;
        padding-top: 72px;
    }

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

    .project-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--dark-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}
