/* ═══════════════════════════════════════════════════════════════
   YAQUT GOLD SHOP POS SYSTEM - Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Gold Theme Palette */
    --primary-color: #FFD700;
    --primary-hover: #B8860B;
    --primary-light: rgba(255, 215, 0, 0.1);

    /* Accent Colors */
    --secondary-color: #10B981;
    --secondary-hover: #059669;
    --danger-color: #EF4444;
    --danger-hover: #DC2626;
    --info-color: #3B82F6;
    --warning-color: #F59E0B;

    /* Dark Theme Backgrounds */
    --bg-body: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-header: #111827;
    --bg-input: #111827;

    /* Text Colors */
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --text-dark: #1F2937;

    /* Border & Effects */
    --border-color: #2d2d44;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Typography */
    --font-family: 'Cairo', 'Poppins', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── Header ─── */
header {
    background: linear-gradient(135deg, #111827 0%, #1a1a2e 100%);
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

header .logo-text {
    font-weight: 300;
    opacity: 0.9;
}

/* ─── Navigation ─── */
.navbar {
    position: relative;
    width: 200px;
}

.menu-toggle {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #1a1a2e;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-family);
    transition: all 0.2s;
}

.menu-toggle:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.navbar ul {
    display: none;
    flex-direction: column;
    list-style: none;
    margin: 5px 0 0;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    position: absolute;
    width: 220px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.navbar ul.show {
    display: flex;
}

.navbar ul li {
    width: 100%;
}

.navbar a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 16px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.navbar a:hover {
    background: rgba(255, 215, 0, 0.1);
    color: var(--primary-color);
}

.navbar a.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #1a1a2e;
    font-weight: 700;
}

/* ─── User Controls ─── */
.user-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ─── Container ─── */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
}

.pos-wrapper {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 0 1rem;
    max-width: 100%;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.mb-4 {
    margin-bottom: 1rem;
}

/* ─── Stat Cards ─── */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* ─── POS Layout ─── */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 300px 280px;
    gap: 1rem;
    height: calc(100vh - 180px);
    min-height: 500px;
}

.products-panel {
    overflow: hidden;
}

.products-category {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.panel-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding: 0.25rem;
    height: calc(100% - 80px);
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.product-card .title {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.product-card .price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.product-card .desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    flex-grow: 1;
}

.img-container {
    max-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px auto;
}

.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ─── Cart ─── */
.cart-panel {
    border-right: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

#cartItems {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
    gap: 0.5rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.cart-summary {
    background: var(--bg-body);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: auto;
    border: 1px solid var(--border-color);
}

.cart-summary div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cart-summary .total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* ─── Checkout ─── */
.checkout-panel {
    display: flex;
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
}

.checkout-actions {
    display: grid;
    gap: 0.5rem;
}

/* ─── Form Elements ─── */
.field-group {
    margin-bottom: 1rem;
}

.field-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.2s;
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-family);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}

.input-field::placeholder {
    color: #4B5563;
}

select.input-field option {
    background: var(--bg-card);
    color: var(--text-main);
}

textarea.input-field {
    min-height: 80px;
    resize: vertical;
}

/* ─── Buttons ─── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #1a1a2e;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-family: var(--font-family);
}

.button:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.button:disabled {
    background: #4B5563;
    cursor: not-allowed;
    opacity: 0.7;
}

.button.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.button.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.button.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.button.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.button.full-width {
    width: 100%;
}

.button.category-filter {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.button.category-filter.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #1a1a2e;
    border-color: var(--primary-color);
    font-weight: 700;
}

/* ─── Tables ─── */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table thead {
    background: linear-gradient(135deg, #1a1a2e, #2d2d44);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.data-table td {
    color: var(--text-main);
    font-size: 0.9rem;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 215, 0, 0.03);
}

/* ─── Modals ─── */
.password-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.password-modal[aria-hidden="false"] {
    display: flex;
}

.password-modal > .card {
    animation: slideUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ─── Responsive ─── */
@media (max-width: 1200px) {
    .pos-container {
        grid-template-columns: 1fr 280px;
    }
    .container {
        padding: 0 1rem;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .pos-container {
        grid-template-columns: 1fr 260px;
        grid-template-rows: 1fr auto;
        height: auto;
    }

    .checkout-panel {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 1rem;
    }

    .products-list {
        height: 50vh;
        min-height: 300px;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
    }

    header h1 {
        font-size: 1rem;
    }

    .logo-text {
        display: none;
    }

    .navbar {
        width: 160px;
    }

    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .checkout-panel {
        grid-column: 1 / -1;
        flex-direction: column;
    }

    .products-list {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        height: 45vh;
        min-height: 250px;
    }

    .cart-panel {
        max-height: 300px;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .products-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .button {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .container {
        padding: 0 0.75rem;
    }
}

/* ─── Print Styles ─── */
@media print {
    header, .navbar, .user-controls, .menu-toggle, .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        background: white;
        break-inside: avoid;
    }

    .password-modal {
        display: none !important;
    }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ─── Animations ─── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}