:root {
    --primary-color: #d4af37;
    --secondary-color: #8b7355;
    --accent-color: #f8f9fa;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

.text-primary {
    color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.navbar-brand {
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-section p {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.hero-section .btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Product Cards */
.product-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    will-change: transform, box-shadow;
    transform: translateZ(0);
    overflow: hidden;
    height: 100%;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    text-decoration: none;
    color: inherit;
}

.product-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.product-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(212,175,55,0.3), rgba(139,115,85,0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.product-card .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: calc(100% - 200px);
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.company-name {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.company-name i {
    margin-right: 0.25rem;
    flex-shrink: 0;
}

.product-address {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.product-address i {
    margin-right: 0.25rem;
    flex-shrink: 0;
}

/* Product description removed - no longer needed */

.price-views-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.price-tag {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-block;
    white-space: nowrap;
}

.views-count {
    color: var(--text-light);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.views-count i {
    margin-right: 0.25rem;
}

/* Category Cards */
.category-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    height: 100%;
    text-decoration: none;
    color: var(--text-dark);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    text-decoration: none;
    color: var(--text-dark);
}

.category-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.category-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Dashboard Styles */
.dashboard-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: none;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 15px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Tables */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border: none;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: rgba(212, 175, 55, 0.05);
}

/* Status Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.5em 1em;
    border-radius: 25px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pending {
    background-color: var(--warning-color);
    color: #000;
}

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

.badge-rejected {
    background-color: var(--danger-color);
    color: white;
}

.badge-expired {
    background-color: #6c757d;
    color: white;
}

/* WhatsApp Button */
.whatsapp-btn {
    background-color: #25d366;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.whatsapp-btn:hover {
    background-color: #128c7e;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }

    .hero-section p {
        font-size: 1.1rem;
    }

    .product-card {
        margin-bottom: 1.5rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .product-image {
        height: 180px;
    }

    .product-card .card-body {
        height: calc(100% - 180px);
        padding: 1rem;
    }

    .product-title {
        font-size: 0.95rem;
    }

    .company-name {
        font-size: 0.8rem;
    }

    .product-address {
        font-size: 0.75rem;
    }

    .product-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }

    .price-tag {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .views-count {
        font-size: 0.7rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 60px 0;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .dashboard-card {
        padding: 1.5rem;
    }

    .product-card .card-body {
        padding: 0.875rem;
    }

    .product-image {
        height: 150px;
    }

    .product-card .card-body {
        height: calc(100% - 150px);
        padding: 0.875rem;
    }

    .product-title {
        font-size: 0.9rem;
        margin-bottom: 0.375rem;
    }

    .company-name {
        font-size: 0.75rem;
        margin-bottom: 0.375rem;
    }

    .product-address {
        font-size: 0.7rem;
        margin-bottom: 0.5rem;
    }

    .product-description {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
        -webkit-line-clamp: 1;
    }

    .price-views-row {
        padding-top: 0.5rem;
    }

    .price-tag {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .views-count {
        font-size: 0.65rem;
    }
}

/* Product grid responsive layout - Vertical Grid */
.product-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
}

.product-grid > .col {
    display: block;
    height: 100%;
}

/* Mobile: 2 products per row with equal heights */
@media (max-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .product-card .card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .price-views-row {
        margin-top: auto;
    }
}

/* Tablet: 3 products per row */
@media (min-width: 577px) and (max-width: 991.98px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* Desktop: 4 products per row */
@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }
}

/* Large Desktop: 5 products per row */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 1.25rem;
    }
}

/* Enhanced mobile product card sizing for vertical grid */
@media (max-width: 576px) {
    .product-image {
        height: 140px;
    }
    
    .product-card .card-body {
        height: calc(100% - 140px);
        padding: 0.625rem;
    }
    
    .product-title {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    .company-name {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
    }
    
    .product-address {
        font-size: 0.65rem;
        margin-bottom: 0.375rem;
    }
    
    .price-views-row {
        padding-top: 0.25rem;
    }
    
    .price-tag {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .views-count {
        font-size: 0.6rem;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.sidebar {
    min-height: 100vh;
    color: white;
    padding: 1.5rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    border-radius: 8px;
    margin: 2px 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-sidebar {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

.company-sidebar {
    background: linear-gradient(135deg, #d4af37, #8b7355);
}

.main-content {
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Mobile menu toggle button */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

/* Responsive sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: 250px;
    overflow-y: auto;
    transition: transform 0.3s ease-in-out;
    transform: translateX(-100%);
    background: #343a40;
    color: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar.show {
    transform: translateX(0);
}

/* Desktop: Fixed sidebar */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
        position: fixed;
    }
    
    .main-content {
        margin-left: 250px;
    }
}

/* Main content area */
.main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
    padding: 20px;
    scroll-behavior: smooth;
}

.main-content.shifted {
    margin-left: 250px;
}

/* Smooth scroll to top when menu item is selected */
.main-content {
    scroll-behavior: smooth;
}

/* Sidebar navigation links */
.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* WhatsApp contact button styling */
.sidebar .whatsapp-contact {
    background-color: rgba(37, 211, 102, 0.1);
    color: #25d366 !important;
    border: 1px solid rgba(37, 211, 102, 0.3);
}

.sidebar .whatsapp-contact:hover {
    background-color: rgba(37, 211, 102, 0.2);
    color: #25d366 !important;
    transform: translateX(5px);
}

.whatsapp-btn {
    background-color: #25d366;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.whatsapp-btn:hover {
    background-color: #128c7e;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4);
}

@media (max-width: 991.98px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .main-content {
        padding-top: 70px;
    }
    
    .main-content.shifted {
        margin-left: 0;
    }
    }

    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Fix for line-clamp warning */
    .line-clamp {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .main-content.shifted {
        margin-left: 250px;
    }

    .dashboard-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .table-responsive {
        border-radius: 10px;
    }

    .table thead th {
        font-size: 0.75rem;
        padding: 0.75rem;
    }

    .table tbody td {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .product-filters .col-md-4,
    .product-filters .col-lg-4 {
        margin-bottom: 1rem;
    }

    .product-details-container {
        padding: 1rem;
    }

    .product-details-container .col-lg-6 {
        margin-bottom: 2rem;
    }
}