:root {
    --bg-main: #f8fafc; /* Light background */
    --bg-card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1e40af;
    --secondary: #0891b2;
    --accent: #4f46e5;
    --text-main: #0f172a; /* Dark text for light bg */
    --text-muted: #64748b;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --border: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

/* Layout */
.app-container {
    max-width: 1000px; /* Wider for desktop */
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    box-shadow: 0 0 50px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    #venues-landing, #courses-landing {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1200px;
        flex-direction: row;
    }
    #venues-landing, #courses-landing {
        grid-template-columns: repeat(3, 1fr);
    }
    main { padding: 2.5rem; }
}

#main-content {
    flex: 1;
    padding: 1rem;
    padding-bottom: 5rem; /* Space for bottom navigation if any, or just breathing room */
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

.text-gradient {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navbar */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand img {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.5));
}

.navbar-menu-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

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

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

/* Inputs */
.input-group {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.input-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.input-control:focus {
    border-color: var(--primary);
}

/* Roles / Views */
.view {
    display: none;
    padding: 1rem;
    box-sizing: border-box;
}

.view.active {
    display: block;
}


/* Keypad */
.form-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-row > .input-group {
    flex: 1;
    margin-bottom: 0;
}

.modal-scroll {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

.form-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    margin: 1.5rem 0 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25rem;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.keypad-btn {
    background: #f8fafc;
    border: 1.5px solid var(--border);
    color: var(--text-main);
    padding: 1.25rem;
    border-radius: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.keypad-btn:active {
    background: var(--primary);
    color: white;
    transform: scale(0.95);
}

.receipt-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border);
}

.receipt-line:last-child {
    border-bottom: none;
}

.receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--text-main);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-main);
}

/* QR Simulation */
.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    width: fit-content;
    margin: 1rem auto;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: bold;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-main);
    width: 95%;
    max-width: 800px; /* Wider for dual receipt */
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

/* Sidebar / Menu */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-main);
    z-index: 1000;
    transition: 0.3s ease;
    border-right: 1px solid var(--border);
    padding: 1.5rem;
}

@media (max-width: 480px) {
    .sidebar {
        width: 80%;
        left: -80%;
    }
    .sidebar.open {
        left: 0;
    }
}


.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

/* List Items */
.list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item:last-child {
    border-bottom: none;
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(99, 102, 241, 0.1));
    border: 1px solid var(--primary);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Improved Receipt Styles (Nota de Remisión) */
.receipt-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.voucher {
    background: white;
    color: #333;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    position: relative;
}

.voucher-type {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #999;
}

.voucher-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
}

.voucher-title {
    text-align: center;
    flex: 1;
}

.voucher-title h2 {
    font-size: 0.9rem;
    margin: 0;
    color: #333;
}

.voucher-title h3 {
    font-size: 1.2rem;
    margin: 5px 0;
    text-decoration: underline;
}

.voucher-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-size: 0.75rem;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.voucher-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.voucher-table th {
    background: #333;
    color: white;
    padding: 4px;
    text-align: left;
}

.voucher-table td {
    border: 1px solid #ddd;
    padding: 4px;
}

.voucher-totals {
    float: right;
    width: 200px;
    font-size: 0.8rem;
}

.voucher-footer {
    clear: both;
    margin-top: 1rem;
    font-size: 0.6rem;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
}

.voucher-signatures {
    display: flex;
    justify-content: space-around;
    margin-top: 1.5rem;
    font-size: 0.7rem;
}

.sig-line {
    border-top: 1px solid #333;
    width: 120px;
    text-align: center;
    padding-top: 4px;
}

/* Calendar Styling */
.calendar-container {
    background: white;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: bold;
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    width: 100%;
    overflow-x: auto;
}

/* Responsive tweaks for calendar on small screens */
@media (max-width: 600px) {
    .calendar-grid {
        gap: 2px;
        grid-template-columns: repeat(7, 1fr);
    }
    .calendar-day {
        font-size: 0.7rem;
        min-height: 40px;
    }
    .calendar-days-header {
        font-size: 0.6rem;
    }
}


.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: 0.5rem;
    cursor: default;
}

.day-booked {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.day-available {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.calendar-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    margin-top: 1rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 350px;
    perspective: 1000px;
    margin-bottom: 2rem;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.flip-card-front {
    background: var(--bg-card);
}

.flip-card-back {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    color: var(--text-main);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
}

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

.flip-card-info {
    padding: 1rem;
    text-align: left;
}

/* Hero Section */
.hero {
    padding: 3rem 1rem;
    text-align: center;
    background: linear-gradient(to bottom, rgba(59, 130, 246, 0.1), transparent);
    border-radius: 0 0 3rem 3rem;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.section-title {
    margin: 2rem 0 1rem;
    padding-left: 0.5rem;
    border-left: 4px solid var(--primary);
}

#venues-landing, #courses-landing {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-primary { background: var(--primary); color: white; }
.badge-secondary { background: var(--secondary); color: white; }

/* Rental Form & Enhancements */
.form-section-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.5rem 0 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25rem;
}

.photo-capture-btn {
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.photo-capture-btn:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

#instructor-result .card {
    border-left: 6px solid var(--success);
    background: #f0fdf4;
}
