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

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #be1e2d; /* Nippon Red */
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px; /* Slightly sharper premium feel */
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-color: #ffffff;
    --secondary-color: #f1f5f9;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.logo-container {
    margin-bottom: 3rem;
    text-align: center;
}

.logo-container img {
    max-width: 150px;
    height: auto;
    filter: brightness(0) invert(1);
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-links a i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 1rem 2rem;
    min-width: 0; /* Prevent flex blowout */
}



.content {
    max-width: 1200px;
    margin: 0 auto;
}

.content-full {
    max-width: none !important;
}


.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem; /* Shrunk from 2.5rem */
}


.page-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* Cards & Containers */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    filter: brightness(1.1);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(190, 30, 45, 0.15);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
}

.table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dashboard-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.action-card, .info-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 130px;
    height: 130px;
    flex-shrink: 0;
}

.action-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 25px 30px -5px rgba(190, 30, 45, 0.15);
}

.info-card {
    background: linear-gradient(135deg, var(--card-bg), var(--bg-color));
}

.action-card i, .info-card i {
    font-size: 2rem;
}

.action-card i {
    color: var(--accent-color);
}

.info-card.proformas i { color: #f59e0b; }
.info-card.agencies i { color: #10b981; }

.action-card span, .info-card span {
    font-size: 0.65rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.info-card .value {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-color);
    line-height: 1;
}

/* Utilities & Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-span-12 { grid-column: span 12 / span 12; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-1 { grid-column: span 1 / span 1; }
.gap-3 { gap: 0.75rem; }
.items-end { align-items: flex-end; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.block { display: block; }
.mb-1 { margin-bottom: 0.25rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.rounded-lg { border-radius: 0.5rem; }
.bg-gray-50 { background-color: #f9fafb; }
.transition-opacity { transition: opacity 0.2s; }
.hover\:opacity-70:hover { opacity: 0.7; }

/* Hide labels in subsequent room rows */
#room-items .room-item:not(:first-child) label {
    display: none;
}
#room-items .room-item:not(:first-child) {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}


/* Hide Number Input Arrows */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}



/* Page Specific Fixes */
.page-title {
    margin-bottom: 2rem; /* Added space before buttons */
}

.page-title h1 {
    font-size: 1.5rem; /* Slightly smaller for tighter fit */
    margin: 0;
}

.page-title p {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Table Action Buttons */
.btn-action-group {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-icon-circle.pdf { background: rgba(190, 30, 45, 0.1); color: var(--accent-color); }
.btn-icon-circle.edit { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.btn-icon-circle.delete { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.btn-icon-circle.view { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }

.btn-icon-circle:hover {
    transform: scale(1.1);
    filter: brightness(0.95);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }


/* --- PREMIUM DASHBOARD UPGRADES --- */

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, var(--accent-color) 0%, #8b1320 100%);
    border-radius: 24px;
    padding: 2.5rem 3rem;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 20px 40px -10px rgba(190, 30, 45, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hero-banner::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="rgba(255,255,255,0.05)" stroke-width="2" fill="none"/></svg>') repeat;
    opacity: 0.5;
    pointer-events: none;
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}
.hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}
.hero-date {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
}

/* Action Cards Upgrade */
.premium-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.premium-action-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}
.premium-action-card:hover {
    transform: translateY(-8px);
    border-color: rgba(190, 30, 45, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}
.premium-action-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.premium-action-card:hover::before {
    transform: scaleX(1);
}
.pac-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(190, 30, 45, 0.1);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}
.premium-action-card:hover .pac-icon {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1) rotate(5deg);
}
.pac-title {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
}

/* Stats Progress */
.stat-progress-bg {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 99px;
    margin-top: 0.5rem;
    overflow: hidden;
}
.stat-progress-bar {
    height: 100%;
    background: var(--accent-color);
    border-radius: 99px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-item-premium {
    padding: 1rem 0;
    border-bottom: 1px solid #f8fafc;
}
.stat-item-premium:last-child {
    border-bottom: none;
}
.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.stat-name {
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-value {
    font-weight: 800;
    color: var(--text-color);
    font-size: 0.95rem;
}
.stat-value-accent {
    color: var(--accent-color);
}

/* Info Cards (Totals) */
.premium-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}
@media (max-width: 768px) {
    .premium-info-grid { grid-template-columns: 1fr; }
    .hero-banner { flex-direction: column; align-items: flex-start; gap: 1rem; }
}
.premium-info-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.premium-info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}
.premium-info-card::after {
    content: '\f080'; /* fa-bar-chart */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: -20px;
    bottom: -20px;
    font-size: 8rem;
    color: rgba(0,0,0,0.02);
    pointer-events: none;
}
.premium-info-card.agencies::after { content: '\f0c0'; } /* fa-users */

.pic-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}
.pic-icon.proformas { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.pic-icon.agencies { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.pic-content {
    display: flex;
    flex-direction: column;
}
.pic-value {
    font-size: 2.25rem;
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}
.pic-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Staggered Animations */
.fade-up-1 { animation: fadeUp 0.6s ease-out 0.1s both; }
.fade-up-2 { animation: fadeUp 0.6s ease-out 0.2s both; }
.fade-up-3 { animation: fadeUp 0.6s ease-out 0.3s both; }
.fade-up-4 { animation: fadeUp 0.6s ease-out 0.4s both; }
.fade-up-5 { animation: fadeUp 0.6s ease-out 0.5s both; }

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

/* --- RESPONSIVE DESIGN (MOBILE & TABLET) --- */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    margin: -1rem -2rem 1.5rem -2rem; /* offset main-content padding */
}

.mobile-header .mobile-logo {
    height: 30px;
    filter: brightness(0) invert(1);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
    backdrop-filter: blur(2px);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: var(--radius);
}

@media (max-width: 992px) {
    /* Tablet layout */
    .sidebar { width: 200px; padding: 2rem 1rem; }
    .main-content { margin-left: 200px; padding: 1rem; }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    /* Mobile layout */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        z-index: 50;
        transition: transform 0.3s ease;
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .mobile-header {
        display: flex;
        margin: -1rem -1rem 1.5rem -1rem;
    }

    /* Collapse Grids */
    .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-12, .lg\:grid-cols-2 { 
        grid-template-columns: minmax(0, 1fr) !important; 
    }
    
    /* Make all col-spans full width */
    .col-span-1, .col-span-2, .col-span-3, .col-span-4, .col-span-6, .col-span-12 { 
        grid-column: span 1 / span 1 !important; 
    }

    /* Hero Banner Mobile */
    .hero-banner {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        border-radius: 16px;
    }
    .hero-banner .date-badge {
        position: static;
        margin-top: 1rem;
        display: inline-flex;
    }
    .hero-banner h2 { font-size: 1.5rem; }

    /* Page Header Mobile */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header .btn { width: 100%; justify-content: center; }

    /* Fix Form Action Buttons inside dynamic rows */
    .row-item {
        padding: 1rem;
        background: #f8fafc;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        margin-bottom: 0.5rem;
    }
    .row-item .flex.justify-end {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }
    
    /* Table specific */
    .table th, .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Fix action card buttons */
    .action-card {
        padding: 1.25rem 1rem;
    }
}
