/* CSLoop Stylesheet - MVP Version */
/* Based on Figma designs with CheckLinQ/Timberland branding */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&display=swap');

:root {
    --primary-teal: #17a2b8;
    --primary-dark: #2C3E50;
    --secondary-gray: #7F8C8D;
    --background-light: #F5F6F8;
    --white: #FFFFFF;
    --border-gray: #E0E0E0;
    --success-green: #00C851;
    --danger-red: #FF4444;
    --warning-yellow: #FFB300;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--background-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login Page Styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.login-container {
    width: 100%;
    max-width: 480px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
}

.logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-text {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo-check {
    background: var(--primary-dark);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 8px 0 0 8px;
}

.logo-linq {
    background: var(--primary-teal);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 0 8px 8px 0;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 15px;
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-size: 15px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: #117a8b;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Standard stat badges (platform-wide) */
.ux-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 22px; }
.ux-stat { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.ux-stat .ico { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: #eaf7fa; flex-shrink: 0; }
.ux-stat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 700; }
.ux-stat .val { font-size: 24px; font-weight: 800; color: #1f2937; line-height: 1.1; }
.ux-stat .sub { font-size: 12px; color: #9ca3af; }

/* Alert Styles */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border-left: 4px solid var(--danger-red);
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border-left: 4px solid var(--success-green);
}

.alert-warning {
    background: #FFF3E0;
    color: #EF6C00;
    border-left: 4px solid var(--warning-yellow);
}

/* Navigation Header */
.header {
    background: var(--white);
    border-bottom: 1px solid #e5e7eb;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.tenant-logo {
    height: auto;
    width: auto;
    max-height: 48px;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.header-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.01em;
    padding: 0 16px;
    height: 100%;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: #111827;
    border-bottom-color: #d1d5db;
}

.nav-link.active {
    color: #17a2b8;
    border-bottom-color: #17a2b8;
    background: transparent;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.user-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.user-menu:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

/* Main Layout */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 15px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Product Grid (from Figma) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.product-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: var(--background-light);
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--white);
}

.badge-available {
    background: var(--success-green);
}

.badge-checked-out {
    background: var(--warning-yellow);
}

.badge-overdue {
    background: var(--danger-red);
}

.product-info {
    padding: 16px;
}

.product-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.product-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.product-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 4px 10px;
    background: var(--background-light);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-light);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-available {
    background: rgba(0, 200, 81, 0.1);
    color: var(--success-green);
}

.status-available::before {
    background: var(--success-green);
}

.status-checked-out {
    background: rgba(255, 179, 0, 0.1);
    color: var(--warning-yellow);
}

.status-checked-out::before {
    background: var(--warning-yellow);
}

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

.table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-gray);
}

.table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-gray);
}

.table tbody tr:hover {
    background: var(--background-light);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-md);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

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

.close-modal {
    font-size: 32px;
    font-weight: 300;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-dark);
}

/* Reservation Modal Calendar Styles */
#calendarContainer .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 16px;
}

#calendarContainer .calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
    padding: 8px 4px;
}

#calendarContainer .calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border: 2px solid var(--border-gray);
    background: white;
    min-height: 40px;
}

#calendarContainer .calendar-day:not(.disabled):hover {
    background: var(--background-light);
    border-color: var(--primary-teal);
}

#calendarContainer .calendar-day.selected {
    background: var(--primary-teal);
    color: var(--white);
    font-weight: 600;
    border-color: var(--primary-teal);
}

#calendarContainer .calendar-day.disabled {
    color: var(--border-gray);
    background: #fafafa;
    cursor: not-allowed;
    border-color: var(--border-gray);
}

/* Variant Selection Styles */
.variant-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.variant-row select,
.variant-row input[type="number"] {
    margin: 0;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.hint {
    font-size: 13px;
    color: var(--text-light);
    margin: 4px 0;
}

.login-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-gray);
    text-align: center;
}

/* ═══ Responsive Design ═══ */
@media (max-width: 768px) {
    /* Let header.php control nav visibility via .mobile-open class */
    .header-nav {
        display: none !important;
    }
    
    .header-nav.mobile-open {
        display: flex !important;
    }

    .header {
        padding: 0 12px;
        height: 56px;
        position: sticky;
        top: 0;
        z-index: 999;
    }

    .product-grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .login-card {
        padding: 32px 24px;
    }
    
    .main-container {
        padding: 12px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .page-header {
        margin-bottom: 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Tables scroll horizontally on mobile */
    .card {
        padding: 16px;
        overflow-x: auto;
    }
    
    .table {
        min-width: 500px;
    }

    /* Buttons */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Product cards smaller on mobile */
    .product-image {
        height: 160px;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 14px;
    }

    /* Modal full-width on mobile */
    .modal-content {
        max-width: 100%;
        margin: 0 8px;
        max-height: 85vh;
    }

    /* Forms */
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="date"],
    .form-group input[type="number"],
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Utility: flex wrap on mobile */
    .d-flex {
        flex-wrap: wrap;
    }

    /* Header user hidden (mobile menu has its own user section) */
    .header-user {
        display: none !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    input,
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on focus */
    }
}
