/*
 * PROJECT: Wafer.AI by Dr. Food
 * DESCRIPTION: Custom high-tech UI with particle network background.
 */

:root {
    --bg-dark: #050a15;
    --accent-light: #45A29E;
    --accent-bright: #66FCF1;
    --accent-success: #25D366; 
    --text-main: #ffffff;
    --text-muted: #c5c6c7;
    --card-bg: rgba(11, 12, 16, 0.7);
}

.price-stack {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.original-price {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: line-through;
    opacity: 0.8;
}

.discount-price {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
}

.discount-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    color: var(--bg-dark);
    background: var(--accent-bright);
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 7px;
}

.muted-row {
    color: var(--text-muted);
}

.muted-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.checkout-container {
    max-width: 920px;
}

.checkout-card {
    align-items: flex-start;
}

.checkout-summary,
.payment-form {
    flex: 1;
    width: 100%;
}

.payment-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.payment-button {
    width: 100%;
}

.required-card-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(102, 252, 241, 0.25);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 14px;
    padding: 14px;
    margin-bottom: 20px;
}

.required-card-logo-wrap {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    overflow: hidden;
    background: #ed174b;
}

.required-card-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.required-card-copy {
    align-self: center;
}

.required-card-copy strong,
.required-card-copy span {
    display: block;
}

.required-card-copy strong {
    color: var(--accent-bright);
    font-size: 1rem;
    margin-bottom: 4px;
}

.required-card-copy span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.required-card-image {
    grid-column: 1 / -1;
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
}

.field-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 6px;
}

.center-error {
    text-align: center;
}

.success-card {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.admin-container {
    max-width: 1180px;
}

.admin-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 10px 0 24px;
}

.admin-title {
    text-align: left;
    margin: 10px 0 0;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card,
.admin-panel,
.admin-table-wrap {
    background: var(--card-bg);
    border: 1px solid rgba(102, 252, 241, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    color: var(--text-muted);
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.stat-card strong {
    color: var(--accent-bright);
    font-size: 1.5rem;
}

.admin-filter {
    display: grid;
    grid-template-columns: 1fr 180px 170px auto;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-filter input,
.admin-filter select {
    width: 100%;
    padding: 12px;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 252, 241, 0.3);
    border-radius: 5px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--accent-bright);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.admin-table td span {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 3px;
}

.admin-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    color: var(--accent-bright);
    text-decoration: none;
    background: rgba(102, 252, 241, 0.05);
    border: 1px solid rgba(102, 252, 241, 0.35);
    border-radius: 5px;
    cursor: pointer;
}

.admin-link-button:hover {
    background: rgba(102, 252, 241, 0.12);
}

.admin-link-button.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    color: var(--bg-dark);
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 5px 8px;
}

.status-paid {
    background: var(--accent-success);
}

.status-pending_payment {
    background: #ffb84d;
}

.status-opened {
    background: var(--accent-bright);
}

.status-unopened {
    background: #c5c6c7;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    color: var(--text-muted);
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.admin-panel {
    padding: 20px;
    margin-bottom: 18px;
}

.admin-panel h3 {
    color: var(--accent-bright);
    margin-bottom: 14px;
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
}

.detail-list span {
    color: var(--text-muted);
}

.detail-list strong {
    color: var(--text-main);
    overflow-wrap: anywhere;
}

.totals-panel {
    max-width: 520px;
    margin-left: auto;
}

.compact {
    border: 0;
}

.admin-login-card {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.admin-rtl,
.admin-rtl .admin-title,
.admin-rtl .admin-table th,
.admin-rtl .admin-table td {
    text-align: right;
}

.admin-rtl .admin-table td span {
    margin-left: 0;
}

.verification-card {
    min-height: 420px;
    justify-content: center;
}

.centered-flow {
    text-align: center;
}

.loader-ring {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    padding: 8px;
    margin: 0 auto 22px;
    background: conic-gradient(var(--accent-bright), rgba(102, 252, 241, 0.05), var(--accent-bright));
    animation: loader-spin 1s linear infinite;
}

.loader-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #ed174b;
    border: 6px solid var(--bg-dark);
}

.verification-progress {
    width: 100%;
    height: 8px;
    margin-top: 22px;
    background: rgba(102, 252, 241, 0.08);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(102, 252, 241, 0.2);
}

.verification-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent-bright);
    box-shadow: 0 0 12px var(--accent-bright);
    animation: progress-fill 5s linear forwards;
}

.code-entry {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 24px 0 14px;
}

.code-entry input {
    width: 100%;
    aspect-ratio: 1;
    color: var(--accent-bright);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 252, 241, 0.35);
    border-radius: 8px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
}

.code-entry input:focus {
    outline: none;
    border-color: var(--accent-bright);
    box-shadow: 0 0 14px rgba(102, 252, 241, 0.25);
}

.prototype-note {
    color: #ffb84d;
    font-size: 0.82rem;
    text-align: center;
    margin-bottom: 18px;
}

.flow-link {
    text-decoration: none;
}

@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes progress-fill {
    to { width: 100%; }
}

@media (max-width: 800px) {
    .checkout-card,
    .admin-title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .payment-grid,
    .admin-stats,
    .admin-detail-grid,
    .admin-filter {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .totals-panel {
        max-width: none;
    }

    .code-entry {
        gap: 6px;
    }

    .code-entry input {
        font-size: 1.2rem;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Tahoma is excellent for Arabic */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Canvas */
#networkCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Header */
.main-header {
    text-align: center;
    padding: 40px 20px 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.drfood-logo {
    max-width: 100px;
    height: auto;
}

.wafer-logo {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 0 10px var(--accent-bright));
}

/* Agency Badge Styling */
.agency-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(11, 12, 16, 0.5);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(102, 252, 241, 0.2);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 50;
}

.agency-badge span {
    color: var(--accent-bright);
    font-weight: bold;
}

.agency-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 252, 241, 0.2);
    border-color: var(--accent-bright);
    color: var(--text-main);
}

/* Container & Products */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid rgba(102, 252, 241, 0.2);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(102, 252, 241, 0.15);
}

/* Product Image Slider Styles */
.slider-container, .single-image-container {
    width: 250px;
    overflow: hidden; 
    position: relative;
    border-radius: 10px;
    flex-shrink: 0;
    touch-action: pan-y; 
}

.slider-wrapper {
    display: flex;
    transition: transform 0.3s ease-out;
    width: 100%;
}

.product-img {
    width: 100%; 
    flex-shrink: 0;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border-radius: 10px;
    pointer-events: none; 
}

/* Slider Dots */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    background: rgba(102, 252, 241, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: var(--accent-bright);
    box-shadow: 0 0 5px var(--accent-bright);
}

.product-info {
    flex: 1;
}

.product-info h2 {
    color: var(--accent-bright);
    margin-bottom: 5px;
    font-size: 1.6rem;
    line-height: 1.2;
}

.flavor {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 400;
    display: block;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.product-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Hide the old standalone price class to prevent duplication */
.product-info > .price {
    display: none;
}

/* Purchase Options Styling */
.purchase-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.purchase-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid rgba(102, 252, 241, 0.15);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.purchase-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 252, 241, 0.4);
}

.option-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Forces alignment to the left */
    text-align: left;        /* Forces text inside to the left */
    flex: 1;                 /* Takes up all extra space to push minus button away */
    padding-right: 15px;     /* Buffer space so it never touches the button */
}

.option-title {
    font-weight: bold;
    color: var(--accent-bright);
    font-size: 1.05rem;
    margin-bottom: 3px;
}

.option-price {
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Quantity Controls */
.quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    background: transparent;
    border: 2px solid var(--accent-light);
    color: var(--accent-bright);
    width: 35px;
    height: 35px;
    border-radius: 5px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: var(--accent-light);
    color: var(--bg-dark);
}

.qty-input {
    width: 50px;
    height: 35px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-light);
    color: white;
    font-size: 1.1rem;
    border-radius: 5px;
}

/* Place Order Button */
.order-action {
    text-align: center;
    margin-top: 40px;
}

.glow-on-hover {
    width: 220px;
    height: 50px;
    border: none;
    outline: none;
    color: #fff;
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 0;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.glow-on-hover:before {
    content: '';
    background: linear-gradient(45deg, #050a15, #45A29E, #66FCF1, #45A29E, #050a15);
    position: absolute;
    top: -2px; left:-2px;
    background-size: 400%;
    z-index: -1;
    filter: blur(5px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing 20s linear infinite;
    opacity: 1;
    transition: opacity .3s ease-in-out;
    border-radius: 10px;
}

.glow-on-hover:after {
    z-index: -1;
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    left: 0;
    top: 0;
    border-radius: 10px;
    border: 1px solid var(--accent-bright);
}

@keyframes glowing {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 10, 21, 0.9);
    backdrop-filter: blur(5px);
    overflow-y: auto; 
}

.modal-content {
    background: linear-gradient(135deg, #0b0c10, #1f2833);
    border: 1px solid var(--accent-light);
    margin: 5vh auto; 
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 0 30px rgba(102, 252, 241, 0.2);
    
    max-height: 90vh; 
    overflow-y: auto; 
}

/* Custom High-Tech Scrollbar for the modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--accent-light);
    border-radius: 10px;
}

.close {
    color: var(--accent-bright);
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-title {
    color: var(--accent-bright);
    margin-bottom: 20px;
    text-align: center;
}

.order-summary {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: var(--accent-bright);
    margin-top: 10px;
    font-size: 1.1rem;
}

.delivery-charge {
    color: #ffb84d;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 20px;
}

/* Bilingual Form Group Styles */
.form-group {
    margin-bottom: 18px;
}

.bilingual-group .labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.bilingual-group .arabic {
    font-family: Arial, Helvetica, Tahoma, sans-serif; 
    direction: rtl;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 252, 241, 0.3);
    color: white;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-bright);
    background: rgba(255, 255, 255, 0.1);
}

/* Modern Swipe Slider Styles */
.swipe-container {
    margin: 25px 0;
    position: relative;
}

.swipe-track {
    width: 100%;
    height: 50px;
    background: rgba(102, 252, 241, 0.05);
    border: 1px solid rgba(102, 252, 241, 0.3);
    border-radius: 25px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.swipe-handle {
    width: 46px;
    height: 46px;
    background: var(--accent-bright);
    color: var(--bg-dark);
    border-radius: 50%;
    position: absolute;
    left: 2px;
    top: 2px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 0 10px var(--accent-bright);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    touch-action: none; 
}

.swipe-handle:active {
    cursor: grabbing;
}

.swipe-text {
    font-size: 0.85rem;
    color: rgba(102, 252, 241, 0.6);
    pointer-events: none;
    position: relative;
    z-index: 1;
    margin: 0 5px;
    transition: opacity 0.3s ease;
}

.swipe-text.arabic {
    font-family: Arial, Helvetica, Tahoma, sans-serif;
    direction: rtl;
}

/* Success State for Slider */
.swipe-container.confirmed .swipe-track {
    background: rgba(37, 211, 102, 0.1);
    border-color: var(--accent-success);
}

.swipe-container.confirmed .swipe-handle {
    background: var(--accent-success);
    box-shadow: 0 0 10px var(--accent-success);
}

.swipe-container.confirmed .swipe-text {
    opacity: 0;
}

/* Submit Button Disabled State */
.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Floating WhatsApp Button removed */

/* Footer Styling */
footer {
    text-align: center;
    padding: 30px 20px 20px;
    margin-top: 20px;
    background: rgba(0,0,0,0.5);
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Responsive Mobile Adjustments */
@media (max-width: 600px) {
    .product-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }
    
    .slider-container, .single-image-container {
        width: 100%;
        max-width: 300px;
        margin-bottom: 20px;
    }

    .purchase-options {
        align-items: center;
    }

    .purchase-option {
        width: 100%;
    }

    .quantity-wrapper {
        justify-content: center;
    }
    
    .wafer-logo {
        max-width: 200px;
    }

    .modal-content {
        padding: 20px;
        margin: 2.5vh auto; 
        max-height: 95vh;
    }

    .swipe-text {
        font-size: 0.75rem;
    }

    .agency-badge {
        top: 10px;
        left: 10px;
        font-size: 0.65rem;
        padding: 4px 8px;
    }
}
