/**
 * PGxPO Dev - Main Stylesheet
 * Colors: Background #1f213b, Primary #e8a742
 * Font: Cairo
 * 
 * Mobile Navigation Update:
 * - Added responsive bottom navigation bar for mobile devices
 * - Navigation appears at bottom of screen on devices < 768px
 * - Horizontal scrollable menu with smooth scrolling
 * - Active state highlighting for current page
 * - Badge support for cart count and notifications
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&display=swap');

:root {
    --bg-color: #1f213b;
    --primary-color: #e8a742;
    --white: #ffffff;
    --black: #000000;
    --card-bg: #2a2d4a;
    --border-color: #3a3d5a;
    --text-light: #b8b9c9;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196f3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--white);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    opacity: 0.8;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1f213b 0%, #2a2d4a 100%);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-menu a {
    color: var(--white);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-menu a:hover {
    background: rgba(232, 167, 66, 0.1);
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--black);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(232, 167, 66, 0.4);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--white);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
}

.card-body {
    color: var(--text-light);
}

/* Grid System */
.grid {
    display: grid;
    gap: 25px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--white);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--white);
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 167, 66, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    cursor: pointer;
}

/* Stats Cards */
.stats-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-3px);
}

.stats-icon {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.stats-icon.primary {
    background: rgba(232, 167, 66, 0.15);
    color: var(--primary-color);
}

.stats-icon.success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.stats-icon.info {
    background: rgba(33, 150, 243, 0.15);
    color: var(--info);
}

.stats-icon.warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning);
}

.stats-content h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stats-content p {
    color: var(--text-light);
    font-size: 14px;
}

.stats-change {
    font-size: 13px;
    margin-top: 5px;
}

.stats-change.up {
    color: var(--success);
}

.stats-change.down {
    color: var(--danger);
}

/* Table */
.table-responsive {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: rgba(232, 167, 66, 0.1);
}

table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--white);
    border-bottom: 2px solid var(--border-color);
}

table td {
    padding: 15px;
    text-align: right;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-color);
}

table tr:hover {
    background: rgba(232, 167, 66, 0.05);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(33, 150, 243, 0.2);
    color: var(--info);
}

.badge-primary {
    background: rgba(232, 167, 66, 0.2);
    color: var(--primary-color);
}

/* Product Card */
.product-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-color);
}

.product-content {
    padding: 20px;
}

.product-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--white);
}

.product-description {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-light);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(232, 167, 66, 0.1);
    color: var(--primary-color);
}

.sidebar-menu i {
    font-size: 20px;
    width: 24px;
}

/* Alert */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(76, 175, 80, 0.15);
    border-right: 4px solid var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(244, 67, 54, 0.15);
    border-right: 4px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(255, 152, 0, 0.15);
    border-right: 4px solid var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(33, 150, 243, 0.15);
    border-right: 4px solid var(--info);
    color: var(--info);
}

/* Footer */
.footer {
    background: var(--card-bg);
    padding: 40px 0 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--text-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-top: 30px;
}

.dashboard-content {
    min-height: calc(100vh - 200px);
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 10px;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--danger);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1f213b 0%, #2a2d4a 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 8px 0;
    border-top: 2px solid var(--primary-color);
}

.mobile-nav-container {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 10px;
    gap: 5px;
}

.mobile-nav-container::-webkit-scrollbar {
    display: none;
}

.mobile-nav-item {
    flex: 0 0 auto;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    background: rgba(232, 167, 66, 0.15);
    color: var(--primary-color);
}

.mobile-nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
}

.mobile-nav-item span {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.mobile-nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: var(--primary-color);
    color: var(--black);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

.mobile-nav-item.btn-primary {
    background: var(--primary-color);
    color: var(--black);
    font-weight: 700;
    min-width: 90px;
}

.mobile-nav-item.btn-primary:hover {
    background: var(--primary-color);
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }
    
    .header {
        position: relative;
        padding: 15px 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        display: none;
    }
    
    .mobile-bottom-nav {
        display: block;
    }
    
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .stats-card {
        flex-direction: column;
        text-align: center;
    }
    
    .table-responsive {
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 10px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .footer {
        margin-bottom: 0;
        padding-bottom: 80px;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }
.gap-3 { gap: 30px; }

.hidden {
    display: none;
}

/* Modern Product Cards */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    color: var(--primary-color);
}

.section-link {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.section-link:hover {
    gap: 12px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.products-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.products-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.product-card-modern {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, var(--primary-color), #d89632);
    color: var(--black);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(232, 167, 66, 0.4);
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--bg-color);
}

.product-image-modern {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s ease;
}

.product-card-modern:hover .product-image-modern {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 33, 59, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.product-card-modern:hover .product-overlay {
    opacity: 1;
}

.btn-view-product {
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--black);
    border-radius: 25px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-view-product:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(232, 167, 66, 0.5);
}

.product-content-modern {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-title-modern {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-title-modern a {
    color: var(--white);
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title-modern a:hover {
    color: var(--primary-color);
}

.product-description-modern {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-meta-modern {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.meta-item-modern {
    color: var(--text-light);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item-modern i {
    color: var(--primary-color);
    font-size: 14px;
}

.product-footer-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price-modern {
    font-size: 26px;
    font-weight: 900;
    color: var(--primary-color);
}

.btn-add-cart {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(232, 167, 66, 0.15);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-add-cart:hover {
    background: var(--primary-color);
    color: var(--black);
    transform: rotate(15deg) scale(1.1);
}

/* Responsive Product Grid */
@media (max-width: 1200px) {
    .products-grid,
    .products-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid,
    .products-grid-3,
    .products-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .section-title {
        font-size: 26px;
    }
}

@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw;
        width: 100%;
    }
    
    .container {
        padding: 0 15px;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }
    
    main {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    /* Prevent images from overflowing */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Prevent all elements from overflowing */
    div, section, article, aside, header, footer, nav {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .products-grid,
    .products-grid-3,
    .products-grid-4 {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .product-image-wrapper {
        height: 200px;
    }
    
    /* Make product page sidebar responsive */
    .products-page-layout {
        display: block !important;
        grid-template-columns: 1fr !important;
    }
    
    .products-sidebar .card {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .products-sidebar h3 {
        font-size: 16px !important;
        margin-bottom: 15px !important;
    }
    
    .categories-list {
        display: flex !important;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -15px;
        padding: 0 15px 10px 15px;
    }
    
    .categories-list::-webkit-scrollbar {
        display: none;
    }
    
    .categories-list li {
        flex: 0 0 auto;
        margin-bottom: 0 !important;
    }
    
    .category-link {
        white-space: nowrap !important;
        padding: 8px 16px !important;
        font-size: 14px;
    }
    
    .products-main-content {
        width: 100%;
        overflow-x: hidden;
    }
}

/* Category Cards Enhancement */
.grid-4 .card {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.grid-4 .card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
}
