@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary: #ff6b00;
    --primary-light: #ff8c33;
    --primary-dark: #cc5600;
    --primary-glow: rgba(255, 107, 0, 0.4);
    --secondary: #6366f1;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --surface: #ffffff;
    --border: #e2e8f0;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Outfit', 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 38px;
    object-fit: contain;
}

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

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 50px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Navigation */
.nav-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 100px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.nav-btn {
    border: none;
    padding: 6px 18px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover {
    color: var(--text-main);
}

.nav-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Premium Search Box */
.search-box-premium {
    background: white;
    padding: 20px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}

.search-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.search-header p {
    color: var(--text-muted);
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.search-input-wrapper {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    font-size: 0.95rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: all 0.3s;
    font-family: inherit;
    font-weight: 600;
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary-glow {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-primary-glow:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
}

/* Premium Order Card (Gate View) */
.order-card-premium {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    animation: slideUp 0.4s ease-out;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.order-info-main .label {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.order-info-main h3 {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    margin-top: 0;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.status-badge.paid {
    background: #dcfce7;
    color: #166534;
}

.status-badge.unpaid {
    background: #fee2e2;
    color: #991b1b;
}

/* Details Grid Cells */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.detail-tile {
    background: #f8fafc;
    padding: 12px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.detail-tile.full-width {
    grid-column: span 2;
}

.detail-tile.highlight {
    background: #fff8f1;
    border-color: #fee2d5;
}

.form-group.full-width {
    grid-column: span 2;
}

.bulk-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.bulk-instructions {
    flex: 1;
    background: #e0f2fe;
    color: #0369a1;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0 !important;
}

.btn-sample-download {
    background: #f1f5f9;
    color: #475569;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.btn-sample-download:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.btn-csv-upload {
    background: var(--secondary);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.csv-upload-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Modal Fixes */
.modal-content {
    background: white;
    width: 95%;
    max-width: 900px;
    border-radius: 20px;
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
}

.btn-main {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-main:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.tile-content {
    display: flex;
    flex-direction: column;
}

.tile-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.tile-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Action Footer */
.card-footer {
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.action-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.print-actions {
    display: flex;
    gap: 12px;
}

.btn-action {
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-pay-now {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-pay-now:hover {
    background: #059669;
    transform: scale(1.02);
}

.btn-complete-entry {
    background: #6366f1;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-complete-entry:hover {
    background: #4f46e5;
    transform: scale(1.02);
}

/* Order History (Wide View) */
.list-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 30px;
    box-shadow: var(--shadow-lg);
    width: 100%;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.list-title h2 {
    font-size: 1.5rem;
    font-weight: 800;
}

.list-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-small-glow {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--primary-glow);
    transition: all 0.3s;
}

.btn-small-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.add-order-container {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}

.form-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 16px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #e2e8f0;
    color: var(--text-main);
}

.form-grid-premium {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.mode-content.hidden {
    display: none;
}

.btn-primary-dark {
    width: 100%;
    padding: 16px;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary-dark:hover {
    background: #1e293b;
    transform: scale(1.01);
}

/* Bulk Specific */
.bulk-instructions {
    background: #e0f2fe;
    color: #0369a1;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

textarea#bulkData {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    margin-bottom: 20px;
    outline: none;
    resize: vertical;
}

textarea#bulkData:focus {
    border-color: var(--primary);
}

.bulk-settings {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

/* Premium Table V2 */
.premium-table-v2 {
    width: 100%;
    border-collapse: collapse;
}

.premium-table-v2 th {
    text-align: left;
    padding: 12px 15px;
    background: #f1f5f9;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.premium-table-v2 td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

.premium-table-v2 tr:hover {
    background: #f8fafc;
}

.order-id-main {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-main);
}

.order-id-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-label {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
}

.status-label.paid {
    background: #dcfce7;
    color: #166534;
}

.status-label.unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.status-label.completed {
    background: #dcfce7;
    color: #166534;
}

.status-label.remaining {
    background: #fef3c7;
    color: #92400e;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Order List Section */
.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.add-order-form {
    background: #f8fafc;
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.add-order-form.hidden {
    display: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
}

.btn-primary-full {
    width: 100%;
    padding: 14px;
    background: var(--text-main);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

/* Table Styling */
.premium-table {
    width: 100%;
    border-collapse: collapse;
}

.premium-table th {
    text-align: left;
    padding: 16px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

.premium-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.premium-table tr:hover {
    background: #f9fafb;
}

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

.status-unpaid {
    color: var(--danger);
}

/* Modal & Review */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 650px;
    border-radius: var(--radius-lg);
    padding: 25px 40px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.preview-img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    background: white;
}

/* Icon Buttons for Actions */
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-icon.view {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-icon.edit {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-icon.delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-icon:hover {
    transform: scale(1.1);
    filter: brightness(95%);
}

/* User Info in Header */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: #f1f5f9;
    border-radius: 50px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ff6b00 0%, #ff8c33 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: white;
    text-transform: uppercase;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-role {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.05);
}

/* Admin Role Badges */
.role-badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.role-badge.superadmin {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.role-badge.admin {
    background: #e0f2fe;
    color: #0369a1;
}

.status-active {
    background: #dcfce7;
    color: #166534;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Admin Table Specific */
.admin-info-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: white;
    text-transform: uppercase;
}

.admin-details .admin-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    display: block;
}

.admin-details .admin-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .user-details {
        display: none;
    }

    .user-info {
        padding: 6px;
    }

    .header-right {
        gap: 8px;
    }
}

/* Print Fixes (Keep these at end) */
@media print {
    @page {
        margin: 0;
        size: 80mm auto;
    }

    header,
    .container,
    .modal,
    .nav-bar {
        display: none !important;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
    }

    #printArea {
        display: block !important;
        width: 80mm;
    }

    .print-img {
        width: 100%;
        display: block;
        image-rendering: -webkit-optimize-contrast;
        page-break-after: always;
    }
}