/**
 * MEATIOWA Account Dashboard Styles
 * Consumer account management page
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    /* Match barn-red theme from store for consistent consumer experience */
    --primary: #8B2323;
    --primary-dark: #6B1A1A;
    --primary-light: #A52A2A;
    --accent: #6B8E6B;
    --accent-light: #8FAF8F;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-primary: #f8f9fa;
    --bg-white: #ffffff;
    --bg-cream: #faf8f5;
    --border-color: #e5e5e5;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --header-height: 70px;
    --sidebar-width: 280px;
    --transition: all 0.2s ease;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo-tagline {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: -4px;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--bg-primary);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(45, 90, 39, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-greeting {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================
   Main Layout
   ============================================ */
.main-content {
    padding-top: var(--header-height);
    min-height: 100vh;
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.user-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.user-avatar {
    width: 56px;
    height: 56px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.5rem;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav .nav-item:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
    background: rgba(45, 90, 39, 0.1);
    color: var(--primary);
}

.sidebar-nav .nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Content Area
   ============================================ */
.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

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

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

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.content-header h1 i {
    color: var(--primary);
}

.content-header p {
    color: var(--text-secondary);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

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

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

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

/* ============================================
   Orders Tab
   ============================================ */
.orders-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
}

.order-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

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

.order-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.order-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.order-status {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.order-status.pending {
    background: #fff3cd;
    color: #856404;
}

.order-status.processing {
    background: #cce5ff;
    color: #004085;
}

.order-status.ready {
    background: #d4edda;
    color: #155724;
}

.order-status.completed {
    background: #e2e3e5;
    color: #383d41;
}

.order-status.cancelled {
    background: #f8d7da;
    color: #721c24;
}

.order-items {
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

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

.order-item-qty {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.order-item-price {
    font-weight: 600;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.order-total {
    font-size: 1.1rem;
    font-weight: 700;
}

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

.order-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.loading-state, .empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.loading-state i, .empty-state i {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--text-muted);
}

/* ============================================
   Forms
   ============================================ */
.form-section {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.form-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

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

.form-group input:disabled {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Password Input */
.password-input {
    position: relative;
}

.password-input input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: var(--text-primary);
}

/* ============================================
   Checkbox Cards & Lists
   ============================================ */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.checkbox-card {
    cursor: pointer;
}

.checkbox-card input {
    display: none;
}

.checkbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition);
}

.checkbox-content i {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.checkbox-card input:checked + .checkbox-content {
    border-color: var(--primary);
    background: rgba(45, 90, 39, 0.1);
}

.checkbox-card input:checked + .checkbox-content i {
    color: var(--primary);
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ============================================
   Toggle Switches
   ============================================ */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

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

.toggle-info {
    flex: 1;
}

.toggle-info strong {
    display: block;
    font-weight: 500;
    margin-bottom: 2px;
}

.toggle-info small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.toggle-item input {
    display: none;
}

.toggle-switch {
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
    margin-left: 16px;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-item input:checked + .toggle-switch {
    background: var(--primary);
}

.toggle-item input:checked + .toggle-switch::after {
    left: 24px;
}

/* ============================================
   Danger Zone
   ============================================ */
.danger-zone {
    border-color: var(--danger);
}

.danger-zone h3 {
    color: var(--danger);
}

.danger-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.danger-info strong {
    display: block;
    margin-bottom: 4px;
}

.danger-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   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: 24px;
}

.modal.open {
    display: flex;
}

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

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
}

/* ============================================
   Toasts
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast i {
    font-size: 1.25rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }

.toast-content {
    flex: 1;
}

.toast-content strong {
    display: block;
    margin-bottom: 2px;
}

.toast-content span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .sidebar-nav .nav-item {
        padding: 10px 14px;
    }

    .sidebar-nav .nav-item span {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .user-card {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
}

@media (max-width: 768px) {
    .header-nav {
        display: none;
    }

    .content-area {
        padding: 24px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .order-header {
        flex-direction: column;
        gap: 12px;
    }

    .order-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .order-actions {
        width: 100%;
    }

    .order-actions .btn {
        flex: 1;
    }

    .danger-item {
        flex-direction: column;
        align-items: flex-start;
    }

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

@media (max-width: 480px) {
    .sidebar-nav .nav-item {
        padding: 10px;
    }

    .sidebar-nav .nav-item i {
        width: auto;
    }

    .content-header h1 {
        font-size: 1.5rem;
    }

    .orders-filters {
        overflow-x: auto;
        padding-bottom: 8px;
        flex-wrap: nowrap;
    }

    .filter-btn {
        white-space: nowrap;
    }
}
