/* Global Reset & Typography */
:root {
    /* Core Colors - Apple-inspired Palette */
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --success-color: #34c759;
    --warning-color: #ff9f0a;
    --danger-color: #ff3b30;

    /* Backgrounds */
    --background-color: #f5f5f7;
    --background-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);

    /* Glassmorphism Variables */
    --card-background: rgba(255, 255, 255, 0.65);
    --card-border: 1px solid rgba(255, 255, 255, 0.4);
    --card-blur: blur(20px);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Text Colors */
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;

    /* UI Elements */
    --border-color: rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);

    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background: var(--background-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* Layout & Container */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

/* Common Glass Card Style */
.glass-card {
    background: var(--card-background);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border-radius: var(--radius-lg);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Header & Announcement */
.announcement-box {
    /* Inherit glass styles */
    background: var(--card-background);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border-radius: var(--radius-lg);
    border: var(--card-border);
    box-shadow: var(--card-shadow);

    padding: 24px;
    margin-bottom: 30px;
}

.announcement-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.announcement-icon {
    font-size: 24px;
    margin-right: 12px;
    background: rgba(255, 255, 255, 0.5);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.announcement-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.announcement-content {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

/* Main Content Grid */
.main-content {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 30px;
    align-items: start;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.left-panel .card:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-height: 0;
}

.left-panel .card:first-child {
    flex-shrink: 0;
}

.left-panel .card {
    margin-bottom: 0;
}

.left-panel .card:last-child .mail-result {
    margin-top: auto;
    flex: 0 0 auto;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .left-panel {
        height: auto;
    }
}

/* Cards (Unified Style) */
.card {
    background: var(--card-background);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border-radius: var(--radius-lg);
    border: var(--card-border);
    box-shadow: var(--card-shadow);

    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(0, 113, 227, 0.15);
    background: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: var(--font-family);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.form-input::placeholder {
    color: #86868b;
    opacity: 0.8;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.2), 0 4px 12px rgba(0, 113, 227, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 50px;
    /* Pill shape */
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(0, 113, 227, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    border: 1px solid rgba(0, 113, 227, 0.1);
}

.btn-secondary:hover {
    background: #fff;
    border-color: rgba(0, 113, 227, 0.3);
}

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

/* Product Grid */
.products-wrapper {
    margin-bottom: 0;
}

.products-wrapper .card-title {
    padding-bottom: 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.product-card {
    /* Inherit glass styles */
    background: var(--card-background);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border-radius: var(--radius-lg);
    border: var(--card-border);
    box-shadow: var(--card-shadow);

    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.8);
}

.product-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.5;
}

.product-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.price {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.price-unit {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: normal;
}

.stock-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 4px;
}

.stock-num {
    font-weight: 600;
    color: var(--success-color);
    background: rgba(52, 199, 89, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 13px;
}

/* Quantity Control */
.quantity-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px;
    border-radius: var(--radius-md);
}

.quantity-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.quantity-input-group {
    display: flex;
    align-items: center;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 16px;
}

.quantity-input:focus {
    outline: none;
}

/* Payment Channels */
.payment-channels {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.payment-channel {
    flex: 1;
    text-align: center;
    padding: 12px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.payment-channel.active {
    border-color: var(--primary-color);
    background: rgba(0, 113, 227, 0.08);
    color: var(--primary-color);
}

/* Mail Check Result */
.mail-result {
    margin-top: 20px;
    display: none;
    animation: slideDown 0.3s ease;
}

.mail-result.show {
    display: block;
}

.result-message {
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.result-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.result-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.result-code {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-success {
    color: var(--success-color);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(255, 255, 255, 0.9);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    margin-bottom: 24px;
    text-align: center;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    color: #86868b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
    transform: rotate(90deg);
}

/* Order Result Specific */
.order-result-card {
    background: var(--card-background);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border-radius: 32px;
    border: var(--card-border);
    box-shadow: var(--card-shadow);

    padding: 40px;
    max-width: 800px;
    width: 100%;
    margin: 40px auto;
}

.status-icon {
    font-size: 72px;
    text-align: center;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.order-info-box {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 30px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

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

.status-1 {
    background: #d1ecf1;
    color: #0c5460;
}

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

.email-accounts-box {
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: var(--radius-md);
    padding: 20px;
    font-family: ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e0e0e0;
    max-height: 40vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Order Detail Layout */
.order-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

.order-info-section,
.accounts-section {
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 113, 227, 0.2);
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.info-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.price-highlight {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 700;
}

/* Status Messages */
.status-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    border-left: 4px solid #ddd;
}

.status-message.status-error {
    background: rgba(255, 243, 224, 0.8);
    border-left-color: #ff9800;
}

.status-message.status-processing {
    background: rgba(224, 247, 250, 0.8);
    border-left-color: #00bcd4;
}

.status-icon {
    font-size: 24px;
    line-height: 1;
}

.status-text {
    flex: 1;
}

.status-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.status-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.status-meta {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

/* Responsive for Order Detail */
@media (max-width: 768px) {
    .order-detail-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal-content {
        padding: 24px;
        max-width: 95%;
    }
}

.action-buttons {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: stretch;
}

.action-buttons .btn {
    flex: 1;
}

/* Custom Scrollbar */
.modal-content::-webkit-scrollbar,
.email-accounts-box::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.modal-content::-webkit-scrollbar-track,
.email-accounts-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb,
.email-accounts-box::-webkit-scrollbar-thumb {
    background: rgba(0, 113, 227, 0.3);
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.email-accounts-box::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 113, 227, 0.5);
}

/* Firefox scrollbar */
.modal-content,
.email-accounts-box {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 113, 227, 0.3) rgba(0, 0, 0, 0.05);
}

.footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 13px;
    opacity: 0.8;
}

.admin-link {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
}

.admin-link:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}