/* Design Inheritance System CSS */
/* Comprehensive styling for the page template system */

/* Base Variables */
:root {
    --page-bg: #f8f9fa;
    --content-bg: #ffffff;
    --border-color: #dee2e6;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-medium: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-heavy: 0 8px 16px rgba(0,0,0,0.15);
    --transition-base: all 0.3s ease;
    --border-radius: 0.5rem;
}

/* Page Wrapper */
.page-wrapper {
    min-height: calc(100vh - 200px);
    background: var(--page-bg);
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-dark) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-opacity='0.1'%3E%3Cpolygon fill='%23ffffff' points='50 0 60 40 100 50 60 60 50 100 40 60 0 50 40 40'/%3E%3C/g%3E%3C/svg%3E") center/100px;
}

.page-header .container {
    position: relative;
    z-index: 1;
}

.page-header h1 {
    margin: 0;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Breadcrumbs */
.breadcrumb-section {
    background: rgba(var(--bs-light-rgb), 0.5);
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    background: transparent;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    margin: 0 0.75rem;
    color: var(--bs-secondary);
    font-weight: 600;
}

.breadcrumb-item a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
}

.breadcrumb-item a:hover {
    color: var(--bs-primary-dark);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--bs-secondary);
}

/* Page Title Section */
.page-title-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.page-title h1 {
    margin: 0;
    font-weight: 600;
    color: var(--bs-dark);
    display: flex;
    align-items: center;
}

.page-title .subtitle {
    color: var(--bs-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 400;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Alert Messages */
.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
    opacity: 0.3;
}

.alert-success {
    border-left-color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), 0.1);
    color: var(--bs-success-dark);
}

.alert-danger {
    border-left-color: var(--bs-danger);
    background: rgba(var(--bs-danger-rgb), 0.1);
    color: var(--bs-danger-dark);
}

.alert-warning {
    border-left-color: var(--bs-warning);
    background: rgba(var(--bs-warning-rgb), 0.1);
    color: var(--bs-warning-dark);
}

.alert-info {
    border-left-color: var(--bs-info);
    background: rgba(var(--bs-info-rgb), 0.1);
    color: var(--bs-info-dark);
}

/* Page Content */
.page-content {
    background: var(--content-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition-base);
}

.page-content:hover {
    box-shadow: var(--shadow-medium);
}

/* Sidebar */
.sidebar {
    background: var(--content-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 1.5rem;
    position: sticky;
    top: 2rem;
}

/* E-commerce Specific Styles */
.ecommerce-page {
    position: relative;
}

/* Cart Summary */
.cart-summary-section .card-header {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-dark) 100%);
    border: none;
}

/* Product Filters */
.product-filters-section {
    position: sticky;
    top: 2rem;
}

.filter-group {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: var(--transition-base);
}

.filter-group:hover {
    box-shadow: var(--shadow-medium);
    border-color: var(--bs-primary);
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-title {
    font-weight: 600;
    color: var(--bs-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-primary);
    display: flex;
    align-items: center;
}

.filter-options {
    max-height: 250px;
    overflow-y: auto;
}

.filter-options::-webkit-scrollbar {
    width: 4px;
}

.filter-options::-webkit-scrollbar-track {
    background: var(--bs-light);
    border-radius: 2px;
}

.filter-options::-webkit-scrollbar-thumb {
    background: var(--bs-primary);
    border-radius: 2px;
}

/* Form Controls in Filters */
.filter-group .form-check {
    margin-bottom: 0.5rem;
    padding-left: 1.75rem;
}

.filter-group .form-check-input {
    margin-left: -1.75rem;
}

.filter-group .form-check-label {
    font-size: 0.9rem;
    color: var(--bs-dark);
    cursor: pointer;
    transition: var(--transition-base);
}

.filter-group .form-check-input:checked ~ .form-check-label {
    color: var(--bs-primary);
    font-weight: 500;
}

/* Filter Actions */
.filter-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Section Headers */
.section-header {
    margin-bottom: 2rem;
    position: relative;
}

.section-title {
    color: var(--bs-primary);
    font-weight: 600;
    margin: 0;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--bs-primary);
    position: relative;
    display: flex;
    align-items: center;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--bs-primary-dark);
}

/* Products Grid */
.products-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.products-grid.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

.products-grid.list-view .product-card {
    max-width: none;
}

.products-grid.list-view .product-card .card {
    flex-direction: row;
}

.products-grid.list-view .product-image-container {
    flex: 0 0 200px;
    height: 150px;
}

/* Product Cards */
.product-card {
    transition: var(--transition-base);
    max-width: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
}

.product-card .card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: var(--transition-base);
    height: 100%;
    overflow: hidden;
}

.product-card:hover .card {
    box-shadow: var(--shadow-heavy);
}

.product-image-container {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-base);
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-base);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.no-image-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, var(--bs-light) 0%, #e9ecef 100%);
    color: var(--bs-secondary);
}

/* Product Information */
.product-name {
    font-weight: 600;
    color: var(--bs-dark);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-description {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--bs-secondary);
    margin-bottom: 1rem;
}

.product-price {
    margin-bottom: 1rem;
}

.price-current {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--bs-primary);
}

.price-old {
    text-decoration: line-through;
    color: var(--bs-secondary);
    font-size: 1rem;
    margin-right: 0.5rem;
}

.discount-badge {
    background: var(--bs-danger);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Stock Status */
.stock-status {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.stock-status.in-stock {
    background: rgba(var(--bs-success-rgb), 0.1);
    color: var(--bs-success);
    border: 1px solid rgba(var(--bs-success-rgb), 0.3);
}

.stock-status.out-of-stock {
    background: rgba(var(--bs-danger-rgb), 0.1);
    color: var(--bs-danger);
    border: 1px solid rgba(var(--bs-danger-rgb), 0.3);
}

.stock-status.low-stock {
    background: rgba(var(--bs-warning-rgb), 0.1);
    color: var(--bs-warning);
    border: 1px solid rgba(var(--bs-warning-rgb), 0.3);
}

/* Shopping Actions */
.shopping-actions-section {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.1) 0%, rgba(var(--bs-light-rgb), 0.1) 100%);
    border-radius: var(--border-radius);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
}

.shopping-actions-section .btn {
    margin: 0.25rem;
    min-width: 140px;
    font-weight: 500;
}

/* Account Page Styles */
.account-sidebar .card {
    border: none;
    box-shadow: var(--shadow-light);
}

.account-sidebar .card-header {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-dark) 100%);
    border: none;
    color: white;
}

.account-nav {
    display: flex;
    flex-direction: column;
}

.account-nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: var(--bs-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-base);
    font-weight: 500;
}

.account-nav-item:hover {
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    text-decoration: none;
    padding-left: 1.5rem;
}

.account-nav-item.active {
    background: var(--bs-primary);
    color: white;
    border-left: 4px solid var(--bs-primary-dark);
}

.account-nav-item.active:hover {
    background: var(--bs-primary-dark);
    color: white;
    padding-left: 1.25rem;
}

.account-nav-item:last-child {
    border-bottom: none;
}

/* Toast Notifications */
.toast-container {
    z-index: 9999;
}

.toast {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    backdrop-filter: blur(10px);
}

/* Page Footer */
.page-footer {
    background: linear-gradient(135deg, var(--bs-light) 0%, #f8f9fa 100%);
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .products-grid.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 992px) {
    .page-title-section {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .page-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .products-grid.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
    
    .product-image-container {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 1.5rem;
    }
    
    .sidebar {
        margin-bottom: 2rem;
        position: static;
    }
    
    .account-nav {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding: 0.5rem;
    }
    
    .account-nav-item {
        flex-shrink: 0;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
        min-width: 140px;
        justify-content: center;
        text-align: center;
        padding: 0.75rem 1rem;
    }
    
    .account-nav-item:last-child {
        border-right: none;
    }
    
    .account-nav-item:hover {
        padding-left: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .product-image-container {
        height: 150px;
    }
    
    .shopping-actions-section .btn {
        display: block;
        width: 100%;
        margin: 0.25rem 0;
        min-width: auto;
    }
}

@media (max-width: 576px) {
    .page-title h1 {
        font-size: 1.5rem;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
    
    .filter-group {
        padding: 1rem;
    }
}

/* Icon Animations */
@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes iconBounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    80% { transform: translateY(-10px); }
}

.loading .fas {
    animation: iconSpin 1s linear infinite;
}

.success .fas {
    animation: iconBounce 1s ease-in-out;
}

/* Accessibility Improvements */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    border-color: var(--bs-primary);
}

/* Print Styles */
@media print {
    .page-header,
    .breadcrumb-section,
    .page-actions,
    .sidebar,
    .product-overlay,
    .shopping-actions-section {
        display: none !important;
    }
    
    .page-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .product-card .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
