/* ═══════════════════════════════════════════════════════════════
   Dashboard — Projects Page
   Sidebar is 280px (matching invoices panel width)
   ═══════════════════════════════════════════════════════════════ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding-top: 44px;
}

/* ─── Top Navigation ─────────────────────────────────────────── */
.top-nav {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 44px;
    background: #2c3e50;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    border-bottom: 2px solid #3498db;
}

.top-nav-links {
    display: flex;
    gap: 4px;
}

.top-nav-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}

.top-nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.top-nav-link.active {
    background: #3498db;
    color: #fff;
}

.top-nav-user {
    margin-left: auto;
    position: relative;
}

.top-nav-user-btn {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border: none;
    border-radius: 5px;
    padding: 5px 11px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
    white-space: nowrap;
    max-width: 220px;
}

.top-nav-user-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

#top-nav-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.top-nav-caret {
    opacity: 0.6;
    font-size: 10px;
}

.top-nav-user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #1a252f;
    border-radius: 7px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 150px;
    overflow: hidden;
    z-index: 200;
}

.top-nav-user-dropdown.open {
    display: block;
}

.top-nav-logout-btn {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 11px 16px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.top-nav-logout-btn:hover {
    background: rgba(231,76,60,0.2);
    color: #e74c3c;
}

/* ─── Layout Shell ───────────────────────────────────────────── */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.15);
}

.sidebar-header {
    padding: 18px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-brand-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.1px;
    line-height: 1.2;
}

/* Search input inside sidebar */
.sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid #46627f;
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    outline: none;
    transition: background 0.2s, border-color 0.2s;
}

.sidebar-search input::placeholder {
    color: rgba(255,255,255,0.45);
}

.sidebar-search input:focus {
    background: rgba(255,255,255,0.2);
    border-color: #3498db;
}

/* Scrollable project list */
.projects-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
}

/* Panel project card */
.panel-project-card {
    padding: 11px 12px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s, border-left-color 0.15s;
}

.panel-project-card:hover {
    background: rgba(255,255,255,0.1);
    border-left-color: rgba(52,152,219,0.6);
}

.panel-project-card.selected {
    background: rgba(52,152,219,0.22);
    border-left-color: #3498db;
}

.pcname {
    font-size: 14px;
    font-weight: 600;
    color: #ecf0f1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.pcaddress {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.pcmeta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pcmeta-item {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #46627f;
    flex-shrink: 0;
}

.sidebar-btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.sidebar-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.nav-icon {
    font-size: 18px;
    margin-right: 10px;
    width: 22px;
    text-align: center;
}

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 24px;
    padding-top: 68px; /* 44px nav + 24px breathing room */
    max-width: calc(100% - 280px);
}

/* ─── Map + Street View Split Row ───────────────────────────── */
.map-sv-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.map-sv-row .map-wrapper {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

.streetview-wrapper {
    flex: 1;
    min-width: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    background: #1a252f;
    transition: height 0.4s ease;
}

.streetview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.streetview-label {
    position: absolute;
    bottom: 10px;
    left: 12px;
    background: rgba(0,0,0,0.45);
    color: white;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* ─── Map Wrapper ────────────────────────────────────────────── */
.map-wrapper {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: height 0.4s ease;
}

.map-wrapper.expanded {
    height: 380px;
}

.map-wrapper.shrunk {
    height: 200px;
}

#map {
    width: 100%;
    height: 100%;
}

/* ─── No-project Prompt ──────────────────────────────────────── */
.no-project-prompt {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.no-project-prompt .empty-state-icon {
    font-size: 52px;
    margin-bottom: 12px;
}

.no-project-prompt h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #7f8c8d;
}

.no-project-prompt p {
    font-size: 14px;
}

/* ─── Detail Sections ────────────────────────────────────────── */
.detail-section {
    background: white;
    border-radius: 12px;
    padding: 22px 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 20px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-section-header h3 {
    font-size: 18px;
    color: #2c3e50;
}

/* Header section specific */
.detail-header-section {
    padding: 16px 22px;
}

.detail-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.detail-title-row h2 {
    font-size: 22px;
    color: #2c3e50;
    margin: 0;
}

.project-address-sub {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* ─── Status Segmented Toggle ───────────────────────────────── */
.status-toggle-group {
    display: flex;
    border-radius: 7px;
    overflow: hidden;
    border: 1.5px solid #dde2e8;
    flex-shrink: 0;
}

.status-toggle-btn {
    background: white;
    border: none;
    border-right: 1.5px solid #dde2e8;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 500;
    color: #95a5a6;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.status-toggle-btn:last-child {
    border-right: none;
}

.status-toggle-btn:hover:not(.active-status) {
    background: #f4f6f7;
    color: #2c3e50;
}

.status-toggle-btn.active-status[data-status="active"] {
    background: #d5f5e3;
    color: #1e8449;
    font-weight: 700;
}

.status-toggle-btn.active-status[data-status="on-hold"] {
    background: #fef9e7;
    color: #b7950b;
    font-weight: 700;
}

.status-toggle-btn.active-status[data-status="cancelled"] {
    background: #fdedec;
    color: #c0392b;
    font-weight: 700;
}

.status-toggle-btn.active-status[data-status="completed"] {
    background: #eaecee;
    color: #717d7e;
    font-weight: 700;
}

.status-toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Status Badges ──────────────────────────────────────────── */
.project-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.project-badge.active {
    background: #d5f5e3;
    color: #1e8449;
}

.project-badge.completed {
    background: #eaecee;
    color: #717d7e;
}

.project-badge.on-hold {
    background: #fef9e7;
    color: #b7950b;
}

.project-badge.cancelled {
    background: #fdedec;
    color: #c0392b;
}

/* Small badge variant for panel cards */
.badge-sm {
    padding: 2px 7px;
    font-size: 10px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.badge-sm.active {
    background: rgba(39,174,96,0.25);
    color: #a9dfbf;
}

.badge-sm.completed {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
}

.badge-sm.on-hold {
    background: rgba(241,196,15,0.25);
    color: #f4d03f;
}

.badge-sm.cancelled {
    background: rgba(231,76,60,0.25);
    color: #f1948a;
}

/* ─── Customer Info Grid ─────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.info-item label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.info-item p {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

/* ─── Notes ──────────────────────────────────────────────────── */
.notes-section textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dde1e4;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    color: #2c3e50;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.notes-section textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

/* ─── Invoices Grid ──────────────────────────────────────────── */
.invoices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.invoice-card {
    padding: 15px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.invoice-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52,152,219,0.15);
    transform: translateY(-2px);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
}

.invoice-number {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-date {
    font-size: 12px;
    color: #7f8c8d;
    white-space: nowrap;
    flex-shrink: 0;
}

.invoice-amount {
    font-size: 20px;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 6px;
}

.invoice-details {
    font-size: 12px;
    color: #7f8c8d;
}

/* ─── Photos Grid ────────────────────────────────────────────── */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.photo-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-card:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.72), transparent);
    color: white;
    padding: 22px 8px 8px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
}

.photo-category-chip {
    display: inline-block;
    background: rgba(52,152,219,0.9);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.photo-date-label {
    font-size: 11px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Empty States ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #95a5a6;
}

.empty-state-icon {
    font-size: 54px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

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

.no-pin {
    color: #bdc3c7;
    font-size: 11px;
    font-style: italic;
}

/* ─── Modals ─────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.25s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

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

.modal-header h2 {
    font-size: 20px;
    color: #2c3e50;
}

.modal-close {
    font-size: 26px;
    background: none;
    border: none;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover { color: #2c3e50; }

.modal-body { padding: 22px 25px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #eee;
}

/* Image Modal */
.image-modal-content {
    max-width: 90%;
    max-height: 90vh;
    padding: 0;
    position: relative;
}

.image-modal-content .modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0,0,0,0.65);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.image-modal-content img {
    width: 100%;
    height: auto;
    display: block;
}

.image-modal-footer {
    padding: 16px;
    text-align: center;
    background: white;
}

/* ─── Photo Review Modal ─────────────────────────────────────── */
.photo-review-modal-content {
    max-width: 860px;
    width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.photo-review-modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
}

.review-count {
    color: #7f8c8d;
    font-size: 13px;
    margin: 2px 0 0;
}

.review-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    padding: 4px 0 8px;
}

.review-photo-item {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.review-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.review-photo-meta { padding: 8px; }

.review-file-name {
    font-size: 11px;
    color: #555;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-category-select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    color: #2c3e50;
}

.review-category-select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}

/* ─── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 10px; }
.main-content::-webkit-scrollbar-thumb { background: #bdc3c7; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Hide project list and search in sidebar on mobile — deferred feature */
    .sidebar-search,
    .projects-panel-list {
        display: none;
    }

    .top-nav { left: 0; }

    .sidebar {
        width: 70px;
    }

    .sidebar-logo { width: 44px; }

    .sidebar-btn span:not(.nav-icon) { display: none; }
    .sidebar-btn { padding: 12px; justify-content: center; }
    .sidebar-btn .nav-icon { margin-right: 0; }

    .main-content {
        margin-left: 70px;
        max-width: calc(100% - 70px);
        padding: 16px;
    }

    .invoices-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .photos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 600px) {
    .review-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
