/* ==========================================
   UNIFIED B2B SMART QUOTES PREMIUM DESIGN SYSTEM
   Theme: Midnight Obsidian & Royal Neon
   ========================================== */

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

:root {
    --bg-dark: #050507; /* Deep midnight */
    --bg-card: rgba(18, 18, 22, 0.65);
    --bg-card-hover: rgba(30, 30, 38, 0.85);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(139, 92, 246, 0.4);
    
    --primary: #8b5cf6; /* Vibrant Purple */
    --primary-glow: rgba(139, 92, 246, 0.25);
    --primary-gradient: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%);
    --primary-hover: #7c3aed;
    
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
    
    --accent: #f59e0b; /* Golden accent */
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --text-title: #ffffff;
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 25px 35px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.25);
    
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-dark);
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 99px;
}

.container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 20px;
}

/* Premium Navbar Header */
.nav-header {
    background: rgba(9, 13, 22, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 12px 30px;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
}

.nav-header:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(99, 102, 241, 0.05);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.logo-text .logo-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.5px;
}
.logo-text .logo-title span {
    color: #818cf8;
}

.logo-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: -2px;
}

.nav-menu, .nav-menu-center, .nav-menu-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-link {
    color: #9ca3af;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    background: transparent;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.login-link {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.login-link:hover {
    color: #818cf8;
}

.btn-nav-login {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}
.btn-nav-login:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-nav-register {
    background: #ffffff;
    color: #090d16;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 900;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}
.btn-nav-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.3);
    background: #f8fafc;
}

.lang-btn {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.lang-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

/* Navbar Mobile Responsiveness */
@media (max-width: 900px) {
    .nav-header {
        flex-direction: column;
        padding: 15px 20px;
        gap: 15px;
        border-radius: var(--radius-md);
    }
    .nav-header .logo-section {
        width: 100%;
        justify-content: center;
    }
    .nav-header > div {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    .nav-menu-center {
        display: none !important;
    }
}

/* Badge Styling */
.badge {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid var(--primary);
    color: #a5b4fc;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Grid & Layout elements */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 25px;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards & Panels */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-title);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

/* Inputs & Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-group input, .form-group textarea {
    width: 100%;
    background: rgba(9, 13, 22, 0.6);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(9, 13, 22, 0.8);
}

/* Premium Date Picker Styles */
input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="date"]:hover {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.06) !important;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

input[type="date"]:focus {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.1) !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3) !important;
}

/* Search bar styling */
.search-container {
    position: relative;
    margin-bottom: 30px;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 50px 16px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

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

/* Upload zone design */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 45px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.01);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 3.2rem;
    color: var(--primary);
    margin-bottom: 15px;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.3));
    transition: transform 0.3s ease;
}

.upload-zone:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-zone p {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.upload-zone span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Table Design */
.preview-container {
    overflow-x: auto;
}

.preview-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 15px;
}

.preview-table th, .preview-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.preview-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-table tr:first-child th:first-child { border-top-right-radius: var(--radius-sm); }
.preview-table tr:first-child th:last-child { border-top-left-radius: var(--radius-sm); }

.preview-table tbody tr {
    transition: background 0.2s ease;
}

.preview-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.preview-table input {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    color: #fff;
    width: 100%;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.preview-table input:focus {
    outline: none;
    border-color: var(--primary);
}

.preview-table input[data-field="part_number"],
.preview-table input[data-field="unit_price"],
input[data-field="part_number"],
input[data-field="unit_price"],
input[name="part_number"] {
    direction: ltr !important;
    text-align: right !important;
}

/* Segmented Tax Control */
.tax-selector-group {
    display: flex;
    gap: 10px;
    background: rgba(9, 13, 22, 0.6);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: var(--radius-sm);
    width: 100%;
}

.tax-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.tax-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.tax-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Custom Columns Styles */
.custom-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.btn-remove-column {
    background: none;
    border: none;
    color: var(--danger);
    opacity: 0.6;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-remove-column:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Buttons System */
.btn {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5), var(--shadow-glow);
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-success {
    background: var(--success-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-delete-row {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.btn-delete-row:hover {
    transform: scale(1.2);
}

/* Products Grid for quote page */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 15px rgba(99, 102, 241, 0.1);
}

.product-card:hover::before {
    opacity: 1;
}

.part-number {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(245, 158, 11, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.product-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.product-price-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    border-top: 1px dashed var(--border-color);
    padding-top: 15px;
}

.price {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--success);
}

.price span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Cart Actions */
.cart-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.qty-display {
    font-weight: 800;
    font-size: 1.1rem;
    width: 28px;
    text-align: center;
}

/* Floating Bottom Bar for Cart */
.floating-cart-bar {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(180px);
    width: 90%;
    max-width: 800px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--primary);
    border-radius: 99px;
    padding: 14px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.2);
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-cart-bar.active {
    transform: translateX(-50%) translateY(0);
}

.cart-summary-text {
    display: flex;
    flex-direction: column;
}

.cart-summary-text .items-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.cart-summary-text .total-price {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--success);
}

/* Checkout Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 580px;
    padding: 35px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

.modal-title {
    font-size: 1.4rem;
    font-weight: 900;
}

.close-modal {
    font-size: 1.8rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

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

/* Alerts System */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    display: none;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.25);
    color: #fca5a5;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: block;
    color: var(--primary);
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.2));
}

.empty-state p {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Add to Cart button style */
.btn-add {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45), var(--shadow-glow);
    transform: translateY(-2px);
    color: #fff;
}

.btn-add:active {
    transform: scale(0.96);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .floating-cart-bar {
        border-radius: var(--radius-md);
        padding: 12px 20px;
    }
}

/* Checkout Button */
.btn-checkout {
    background: var(--success-gradient);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-checkout:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transform: scale(1.04);
}

.btn-checkout:active {
    transform: scale(0.96);
}

/* Modal Submit Button */
.submit-btn {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
    margin-top: 15px;
}

.submit-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Premium Segmented Tax Switcher Control */
.tax-selector-group {
    display: flex;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px;
    width: 100%;
    gap: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tax-selector-group .tax-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: calc(var(--radius-sm) - 2px);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.tax-selector-group .tax-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tax-selector-group .tax-btn.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transform: scale(1.02);
}

.tax-selector-group .tax-btn.active i {
    color: var(--accent);
}

.tax-selector-group .tax-btn i {
    font-size: 1.05rem;
    transition: color 0.3s ease;
}

/* Hide input type number default spin buttons */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Landing Page Feature Cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    text-align: center;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.1);
}

.feature-icon {
    width: 65px;
    height: 65px;
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.8rem;
    margin: 0 auto 25px auto;
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    transform: scale(1.1);
}

.feature-card h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 15px;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* Custom Global Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 460px;
    padding: 35px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    text-align: center;
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* --------------------------------------------------
   Modern Sidebar Layout
   -------------------------------------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
    margin: -20px;
}
.sidebar {
    width: 280px;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 35px;
    padding: 0 10px;
}
.sidebar-brand .logo-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}
.sidebar-brand .logo-text h2 {
    font-size: 1.35rem;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-brand .logo-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: -2px;
}
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}
.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(-4px);
}
.sidebar-link.active {
    color: #fff;
    background: var(--primary-gradient) !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.03);
}
.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.profile-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #fff;
}
.profile-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}
.badge-premium {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.badge-trial {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.badge-expired {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--danger);
    text-decoration: none;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    background: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.1);
    transition: all 0.3s;
}
.logout-btn:hover {
    background: var(--danger-gradient);
    color: #fff;
    box-shadow: 0 4px 10px rgba(244, 63, 94, 0.15);
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 25px;
}
.top-bar-title h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
}
.top-bar-title p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.menu-toggle {
    display: none;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.menu-toggle:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--primary);
}

/* Sidebar backdrop overlay on mobile */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.badge-count {
    background: var(--danger);
    color: #fff;
    padding: 2px 7px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-right: 4px;
}

/* Stats Grid styling */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .app-layout {
        margin: 0;
    }
    .sidebar {
        position: fixed;
        right: -280px;
        top: 0;
        height: 100vh;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.active {
        right: 0;
    }
    .main-content {
        padding: 20px;
    }
    .menu-toggle {
        display: flex;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .top-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 15px;
    }
    .top-bar-title {
        flex: 1;
    }
    .top-bar-actions {
        width: 100%;
    }
    .top-bar-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   GLOBAL MOBILE DEVICE OPTIMIZATIONS
   ========================================== */
@media (max-width: 768px) {
    /* Optimize heading scales for mobile */
    h1 { font-size: 1.6rem; line-height: 1.3; }
    h2 { font-size: 1.4rem; line-height: 1.3; }
    h3 { font-size: 1.2rem; line-height: 1.4; }
    p { font-size: 0.95rem; line-height: 1.6; }

    /* Forms and Inputs must be 16px to prevent iOS zoom, and take full width */
    input, select, textarea {
        font-size: 16px;
        padding: 14px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Form groups spacing */
    .form-group {
        margin-bottom: 15px;
        width: 100%;
    }

    /* Adjust main content paddings for smaller screens */
    .main-content {
        padding: 12px;
    }

    /* Better padding for cards on mobile */
    .card {
        padding: 15px;
        border-radius: var(--radius-sm);
    }
    
    .feature-card {
        padding: 20px 15px;
    }
    
    /* Slightly smaller button paddings but wide for touch */
    .btn {
        padding: 12px 16px;
        font-size: 1rem;
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }
    
    /* Ensure no horizontal scroll on tiny devices */
    body {
        overflow-x: hidden;
    }
    
    /* Improve modal padding for mobile */
    .modal-content {
        padding: 15px;
        width: 95%;
    }

    /* Fix table responsiveness */
    .preview-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }

    /* CRITICAL FIX FOR iOS SAFARI PAYPAL BUG (White Page / Two Pages Issue) */
    /* iOS Safari fails to render iframes (like PayPal popup) correctly when a parent has backdrop-filter or transform */
    .pricing-tier-card, .pricing-card, .status-container, .modal-content, .card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transform: none !important;
        transition: none !important;
    }

    .pricing-tier-card:hover, .pricing-card:hover, .card:hover {
        transform: none !important;
    }

    /* Improve PayPal button container visibility on mobile */
    [id^="paypal-button-container"] {
        position: relative !important;
        z-index: 100 !important;
        min-height: 50px;
        margin-top: 20px;
    }
}

/* Enhancing Icons (Line Awesome) */
i[class^="la-"], i[class*=" la-"], i[class^="fa-"], i[class*=" fa-"] {
    display: inline-block;
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}
i[class^="la-"]:hover, i[class*=" la-"]:hover, i[class^="fa-"]:hover, i[class*=" fa-"]:hover {
    transform: scale(1.1);
    text-shadow: 0 0 8px currentColor;
}

