/* public/css/style.css */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

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

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

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

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

.btn-danger:hover {
    opacity: 0.9;
}

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

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--text);
    font-size: 20px;
}

.card h3 {
    margin-bottom: 15px;
    color: var(--text);
    font-size: 16px;
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Auth Screen */
#auth-screen .container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

#auth-screen .card {
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

#auth-screen h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
}

#auth-screen h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
}

.auth-form button {
    width: 100%;
}

.switch-auth {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 14px;
}

.switch-auth a {
    color: var(--primary);
    text-decoration: none;
}

.switch-auth a:hover {
    text-decoration: underline;
}

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    box-shadow: var(--shadow);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--text-light);
    font-size: 14px;
}

/* Tabs */
.tabs {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tabs .container {
    display: flex;
    gap: 5px;
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text);
    background: var(--background);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Main Content */
.main-content {
    padding: 30px 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Balances */
.balances-list {
    display: grid;
    gap: 12px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.balance-item.negative {
    border-left-color: var(--danger);
}

.balance-name {
    font-weight: 500;
    color: var(--text);
}

.balance-amount {
    font-size: 18px;
    font-weight: 600;
}

.balance-amount.negative {
    color: var(--danger);
}

.balance-amount.positive {
    color: var(--success);
}

/* Popular Items */
.popular-items {
    display: grid;
    gap: 10px;
}

.popular-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

.popular-item-name {
    font-weight: 500;
}

.popular-item-count {
    color: var(--text-light);
    font-size: 14px;
}

/* History */
.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    padding: 15px;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-user {
    font-weight: 600;
    color: var(--text);
}

.history-amount {
    font-weight: 600;
    color: var(--danger);
}

.history-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-light);
}

.history-note {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
}

/* Items */
.items-list {
    margin-top: 20px;
    display: grid;
    gap: 10px;
}

.item-card {
    padding: 15px;
    background: var(--background);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-card.inactive {
    opacity: 0.5;
}

.item-info h4 {
    color: var(--text);
    margin-bottom: 4px;
}

.item-meta {
    font-size: 13px;
    color: var(--text-light);
}

.item-actions {
    display: flex;
    gap: 8px;
}

/* Users */
.users-list {
    margin-top: 20px;
    display: grid;
    gap: 10px;
}

.user-card {
    padding: 15px;
    background: var(--background);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info-card h4 {
    color: var(--text);
    margin-bottom: 4px;
}

.user-meta {
    font-size: 13px;
    color: var(--text-light);
}

.role-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

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

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

/* Filter */
.filter-bar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-bar label {
    margin: 0;
    font-size: 14px;
}

.filter-bar select {
    margin: 0;
    max-width: 250px;
}

/* Messages */
.error,
.success {
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
}

.error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.loading {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .main-content {
        padding: 20px 10px;
    }
    
    .card {
        padding: 16px;
    }
    
    .balance-item,
    .history-item,
    .item-card,
    .user-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .item-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Admin only */
.admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: block !important;
}

body.is-admin .tab.admin-only {
    display: inline-block !important;
}

/* Quick Booking */
.quick-booking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.user-booking-card {
    background: var(--background);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.user-booking-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.user-booking-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.user-booking-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.user-booking-balance {
    font-size: 14px;
    color: var(--text-light);
}

.user-booking-balance.negative {
    color: var(--danger);
    font-weight: 600;
}

.item-buttons {
    display: grid;
    gap: 8px;
}

.item-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text);
    text-align: left;
}

.item-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.item-btn:active {
    transform: translateY(0);
}

.item-btn-name {
    font-weight: 500;
}

.item-btn-price {
    font-weight: 600;
    opacity: 0.8;
}

.item-btn.adding {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.item-btn.adding .item-btn-name::after {
    content: ' ✓';
    margin-left: 5px;
}

/* Quick booking feedback */
.quick-feedback {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.quick-feedback.removing {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

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

.modal form {
    padding: 30px;
}

.modal .form-group {
    margin-bottom: 20px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.modal .form-group input,
.modal .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.modal .form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.modal-actions .btn {
    margin: 0;
}


