/* DePaul Marketplace - Mobile-First Stylesheet */

:root {
    --purple: #5E358D;
    --purple-dark: #4a2a70;
    --purple-light: #7b52ab;
    --cyan: #1CB3E8;
    --cyan-dark: #159acc;
    --cyan-light: #4fc4ed;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f0f0f0;
    --gray-200: #e0e0e0;
    --gray-300: #ccc;
    --gray-600: #666;
    --gray-800: #333;
    --green: #28a745;
    --red: #dc3545;
    --orange: #fd7e14;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 {
    font-family: 'Spline Sans', 'Open Sans', sans-serif;
    font-weight: 700;
}

/* ============ NAVBAR ============ */
.navbar {
    background: var(--purple);
    color: var(--white);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    flex-wrap: wrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    text-decoration: none;
    font-family: 'Spline Sans', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-icon {
    background: var(--cyan);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--white);
    border-radius: 2px;
    transition: 0.3s;
}

.nav-menu {
    display: none;
    width: 100%;
    padding: 8px 0 16px;
}

.nav-menu.open {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

.nav-logout {
    color: rgba(255,255,255,0.6);
}

.nav-balance {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.15);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    line-height: 1.2;
}

.balance-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.balance-amount {
    font-family: 'Spline Sans', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--cyan-light);
}

/* ============ CONTAINER ============ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
    flex: 1;
    width: 100%;
}

/* ============ CARDS ============ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h2, .card-header h3 {
    font-size: 1.2rem;
    color: var(--purple);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Spline Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    min-height: 44px;
    min-width: 44px;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover {
    background: var(--purple-dark);
}

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

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

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

.btn-outline:hover {
    background: var(--purple);
    color: var(--white);
}

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

.btn-danger:hover {
    background: #c82333;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-height: 36px;
}

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

/* ============ FORMS ============ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    transition: border-color 0.2s;
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: var(--cyan);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ============ ALERTS ============ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.95rem;
    font-weight: 600;
}

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

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--red);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--cyan);
}

/* ============ LOGIN PAGE ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 50%, #2a1545 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-family: 'Spline Sans', sans-serif;
    margin-bottom: 8px;
}

.login-logo .brand-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
    margin: 0 auto 12px;
}

.login-logo h1 {
    color: var(--purple);
    font-size: 1.5rem;
}

.login-tagline {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* ============ DASHBOARD ============ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-family: 'Spline Sans', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--purple);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.balance-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    color: var(--white);
}

.stat-card.balance-card .stat-value {
    color: var(--cyan-light);
    font-size: 2.5rem;
}

.stat-card.balance-card .stat-label {
    color: rgba(255,255,255,0.8);
}

/* ============ PRODUCT GRID ============ */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--gray-100);
    display: block;
}

.product-image-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300);
    font-size: 3rem;
}

.product-info {
    padding: 16px;
}

.product-name {
    font-family: 'Spline Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.product-seller {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.product-description {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-family: 'Spline Sans', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--purple);
}

.product-stock {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.stock-available {
    background: #d4edda;
    color: #155724;
}

.stock-low {
    background: #fff3cd;
    color: #856404;
}

.stock-out {
    background: #f8d7da;
    color: #721c24;
}

/* ============ QR CODE PAGE ============ */
.qr-wrapper {
    text-align: center;
    padding: 20px;
}

.qr-wrapper h2 {
    color: var(--purple);
    margin-bottom: 8px;
}

.qr-price {
    font-family: 'Spline Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 20px;
}

.qr-code-container {
    background: var(--white);
    display: inline-block;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.qr-instructions {
    color: var(--gray-600);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* ============ BUY PAGE ============ */
.buy-card {
    max-width: 500px;
    margin: 0 auto;
}

.buy-product-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.buy-details {
    margin-bottom: 20px;
}

.buy-details h2 {
    color: var(--purple);
    margin-bottom: 4px;
}

.buy-seller {
    color: var(--gray-600);
    margin-bottom: 12px;
}

.buy-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--gray-200);
    font-size: 1.1rem;
}

.buy-total {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--purple);
    border-top: 2px solid var(--purple);
}

.buy-balance-info {
    text-align: center;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin: 16px 0;
    font-size: 0.9rem;
}

/* ============ TRANSACTIONS TABLE ============ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background: var(--purple);
    color: var(--white);
    padding: 12px;
    text-align: left;
    font-family: 'Spline Sans', sans-serif;
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

tr:hover {
    background: var(--gray-50);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-purchase {
    background: #d4edda;
    color: #155724;
}

.badge-sale {
    background: #cce5ff;
    color: #004085;
}

.badge-refunded {
    background: #f8d7da;
    color: #721c24;
    text-decoration: line-through;
}

/* ============ ADMIN ============ */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.admin-header h1 {
    color: var(--purple);
}

.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 200px;
}

/* ============ MY PRODUCTS (STUDENT) ============ */
.my-product-card {
    display: flex;
    gap: 16px;
    align-items: center;
}

.my-product-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.my-product-thumb-placeholder {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gray-300);
    font-size: 1.5rem;
}

.my-product-info {
    flex: 1;
    min-width: 0;
}

.my-product-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============ IMAGE UPLOAD ============ */
.image-upload {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.image-upload:hover {
    border-color: var(--cyan);
    background: rgba(28, 179, 232, 0.05);
}

.image-upload input[type="file"] {
    display: none;
}

.image-upload-label {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-600);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
}

/* ============ FOOTER ============ */
.footer {
    background: var(--gray-800);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 16px;
    font-size: 0.85rem;
    margin-top: auto;
}

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-purple { color: var(--purple); }
.text-cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--gray-600); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* ============ RESPONSIVE ============ */

/* Tablet (iPad) */
@media (min-width: 768px) {
    .nav-container {
        flex-wrap: nowrap;
    }

    .nav-toggle {
        display: none;
    }

    .nav-menu {
        display: flex;
        width: auto;
        padding: 0;
        gap: 4px;
        align-items: center;
    }

    .container {
        padding: 24px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-card.balance-card {
        grid-column: auto;
    }

    .login-card {
        padding: 48px 40px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .container {
        padding: 32px;
    }
}
