/* FieldShare – style.css */
/* ==========================================================================
   CSS Custom Properties (Brand Colors)
   ========================================================================== */
:root {
    --fs-primary:        #1a6b3c;
    --fs-primary-dark:   #134f2d;
    --fs-primary-light:  #2a9356;
    --fs-secondary:      #f7a800;
    --fs-secondary-dark: #d48e00;
    --fs-accent:         #1565C0;
    --fs-accent-dark:    #0d47a1;

    /* Cell status colors */
    --cell-free:         #22c55e;
    --cell-free-border:  #16a34a;
    --cell-sold:         #3b82f6;
    --cell-sold-border:  #2563eb;
    --cell-rented:       #d48e00;
    --cell-rented-border:#9333ea;
    --cell-reserved:     #f59e0b;
    --cell-reserved-border: #d97706;
    --cell-disabled:     #9ca3af;
    --cell-disabled-border: #6b7280;
    --cell-premium-ring: #ffd700;

    /* Typography */
    --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
                  Arial, 'Noto Sans', sans-serif;
}

/* ==========================================================================
   Base
   ========================================================================== */
body {
    font-family: var(--font-stack);
    color: #212529;
}

/* Bootstrap primary color override */
.bg-primary { background-color: var(--fs-primary) !important; }
.text-primary { color: var(--fs-primary) !important; }
.btn-primary {
    background-color: var(--fs-primary);
    border-color: var(--fs-primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--fs-primary-dark);
    border-color: var(--fs-primary-dark);
}
.btn-warning {
    background-color: var(--fs-secondary);
    border-color: var(--fs-secondary);
    color: #212529;
}
.btn-warning:hover {
    background-color: var(--fs-secondary-dark);
    border-color: var(--fs-secondary-dark);
    color: #212529;
}
.navbar.bg-primary { background-color: var(--fs-primary) !important; }

/* ==========================================================================
   Field Grid
   ========================================================================== */
.field-grid {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 8px;
    background: #388e3c;
    border-radius: 4px;
    border: 3px solid #2e7d32;
}

.field-cell {
    aspect-ratio: 1;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    overflow: hidden;
}

.field-cell:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
    filter: brightness(1.1);
}

.field-cell.selected {
    box-shadow: 0 0 0 3px var(--fs-secondary) !important;
    transform: scale(1.08);
    z-index: 20;
}

/* Status Colors */
.cell-free,
.status-free {
    background-color: var(--cell-free);
    border-color: var(--cell-free-border);
    color: #388e3c;
}
.cell-sold,
.status-sold {
    background-color: var(--cell-sold);
    border-color: var(--cell-sold-border);
    color: #fff;
    cursor: default;
}
.cell-rented,
.status-rented {
    background-color: var(--cell-rented);
    border-color: var(--cell-rented-border);
    color: #fff;
    cursor: default;
}
.cell-reserved,
.status-reserved {
    background-color: var(--cell-reserved);
    border-color: var(--cell-reserved-border);
    color: #212529;
    cursor: default;
}
.cell-disabled,
.status-disabled {
    background-color: var(--cell-disabled);
    border-color: var(--cell-disabled-border);
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}
.cell-premium,
.is-premium {
    box-shadow: inset 0 0 0 2px var(--cell-premium-ring);
}
.cell-premium::after {
    content: '★';
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.5rem;
    color: var(--cell-premium-ring);
}

/* Tooltip on hover */
.field-cell[data-bs-toggle="tooltip"]:hover::before {
    content: attr(data-cell-label);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

/* Cell owner logo */
.field-cell img.cell-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1px;
}

/* Grid legend */
.grid-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    font-size: 0.85rem;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
}

/* Demo grid on homepage */
.field-grid-demo {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    padding: 12px;
    background: #388e3c;
    border-radius: 8px;
    border: 3px solid #2e7d32;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.demo-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.15);
    animation: pulse-demo 3s ease-in-out infinite;
}
@keyframes pulse-demo {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.85; }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-dark) 60%, #0a3d20 100%);
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255,255,255,0.03) 40px, rgba(255,255,255,0.03) 41px),
        repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255,255,255,0.03) 40px, rgba(255,255,255,0.03) 41px);
    pointer-events: none;
}
.hero-section .text-white-75 { color: rgba(255,255,255,0.85); }

/* Step numbers */
.step-number {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    font-weight: 700;
    background-color: var(--fs-primary) !important;
    box-shadow: 0 4px 16px rgba(26,107,60,0.35);
}
.feature-icon { font-size: 3rem; }

/* ==========================================================================
   Dashboard Cards
   ========================================================================== */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

/* ==========================================================================
   Admin Sidebar
   ========================================================================== */
.admin-layout {
    background: #f8f9fa;
}
.admin-sidebar {
    background: #1a1d20;
    padding-top: 0.5rem;
    border-right: 1px solid #2d3035;
}
.admin-sidebar .nav-link {
    color: #8e96a0;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-sidebar .nav-link i {
    font-size: 1rem;
    flex-shrink: 0;
}
.admin-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: #e9ecef;
}
.admin-sidebar .nav-link.active {
    background: var(--fs-primary);
    color: #fff;
}
.admin-sidebar .nav-link.active i {
    opacity: 1 !important;
}
.admin-sidebar .sidebar-heading {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a5260;
    padding: 0 0.75rem;
    font-weight: 600;
}

/* Desktop persistent sidebar */
.admin-sidebar-desktop {
    position: sticky;
    top: 57px;
    height: calc(100vh - 57px);
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    transition: width 0.2s ease, min-width 0.2s ease;
}
.admin-sidebar-desktop.collapsed,
[data-sidebar="collapsed"] .admin-sidebar-desktop {
    width: 58px;
    min-width: 58px;
}
.admin-sidebar-desktop.collapsed .sidebar-label,
[data-sidebar="collapsed"] .admin-sidebar-desktop .sidebar-label,
.admin-sidebar-desktop.collapsed .sidebar-heading,
[data-sidebar="collapsed"] .admin-sidebar-desktop .sidebar-heading {
    display: none !important;
}
.admin-sidebar-desktop.collapsed .nav-link,
[data-sidebar="collapsed"] .admin-sidebar-desktop .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0 !important;
}
@media (max-width: 767.98px) {
    .admin-sidebar-desktop { display: none !important; }
}

/* ==========================================================================
   Status Badges
   ========================================================================== */
.badge-free     { background: #e8f5e9; color: #2e7d32; }
.badge-sold     { background: var(--fs-primary); color: #fff; }
.badge-rented   { background: var(--fs-accent); color: #fff; }
.badge-reserved { background: var(--fs-secondary); color: #212529; }
.badge-disabled { background: #e0e0e0; color: #616161; }
.badge-pending  { background: #fff3e0; color: #e65100; }
.badge-paid     { background: #e8f5e9; color: #1b5e20; }
.badge-cancelled{ background: #fce4ec; color: #880e4f; }
.badge-failed   { background: #ffebee; color: #b71c1c; }

/* ==========================================================================
   Screen / Display View
   ========================================================================== */
.screen-view body { background: #1a1a1a; }
.screen-field-grid {
    display: grid;
    gap: 3px;
    width: 100vw;
    height: calc(100vh - 80px);
    padding: 12px;
}
.screen-cell {
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.5s ease;
}
.screen-cell img { width: 100%; height: 100%; object-fit: cover; }
@keyframes cell-appear {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
.screen-cell.just-sold {
    animation: cell-appear 0.6s ease forwards;
}

/* ==========================================================================
   Auth Pages
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-dark) 100%);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
}
.auth-logo {
    font-size: 2rem;
    font-weight: 800;
}

/* ==========================================================================
   Logo Upload Preview
   ========================================================================== */
.logo-preview-wrapper {
    width: 120px;
    height: 120px;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
}
.logo-preview-wrapper:hover { border-color: var(--fs-primary); }
.logo-preview-wrapper img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Print Styles (Invoices)
   ========================================================================== */
@media print {
    .navbar, footer, .btn, .no-print { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    body { background: #fff !important; }
    .invoice-header { border-bottom: 2px solid #212529; padding-bottom: 16px; margin-bottom: 24px; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .field-grid { gap: 1px; padding: 4px; }
    .field-cell { font-size: 0.5rem; }
    .error-code { font-size: 5rem; }
}

/* ==========================================================================
   Responsive Enhancements (Bootstrap Icons integration)
   ========================================================================== */

/* Navbar logo responsiveness */
.navbar-brand img { max-height: 36px; width: auto; }

/* Admin offcanvas sidebar (mobile) */
.admin-offcanvas {
    background: #1a1d20;
    color: #8e96a0;
    width: 260px !important;
}
.admin-offcanvas .offcanvas-header {
    background: #111315;
}
.admin-offcanvas .offcanvas-body {
    background: #1a1d20;
}

/* Admin sidebar responsive */
@media (max-width: 991.98px) {
    .admin-main { padding: 1rem !important; }
}

/* Field grid responsive scaling */
@media (max-width: 575.98px) {
    .field-grid {
        gap: 1px;
        padding: 4px;
    }
    .field-cell {
        font-size: 0.45rem;
        min-height: 18px;
    }
    .field-cell-label { display: none; }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .field-cell { min-height: 22px; font-size: 0.55rem; }
}

/* Booking page grid responsive */
.booking-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 991.98px) {
    .booking-layout {
        grid-template-columns: 1fr;
    }
    .booking-summary-panel {
        position: static !important;
    }
}

/* Stats cards */
.stat-card {
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.stat-card .stat-icon {
    font-size: 2.2rem;
    opacity: 0.85;
}

/* Table responsive helpers */
.table-responsive { -webkit-overflow-scrolling: touch; }
.table th { white-space: nowrap; }

/* Screen display responsive */
@media (max-width: 767.98px) {
    .screen-field-grid {
        height: auto;
        min-height: 50vw;
    }
}

/* Auth page responsive */
@media (max-width: 575.98px) {
    .auth-card { border-radius: 0; min-height: 100vh; }
    .auth-wrapper { align-items: flex-start; }
}

/* Hero section responsive */
.hero-section {
    background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-dark) 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}
@media (max-width: 767.98px) {
    .hero-section { padding: 50px 0; }
    .hero-section h1 { font-size: 2rem !important; }
}

/* Footer */
footer a { text-decoration: none; }
footer a:hover { color: #ffffff !important; text-decoration: underline; }

/* Invoice print */
@media print {
    .container { max-width: 100% !important; }
    .invoice-print-wrapper { padding: 0; }
}

/* Mobile table: hide less important columns */
@media (max-width: 767.98px) {
    .hide-mobile { display: none !important; }
}
