/* 
 * ShopHub Responsive Design System
 * Mobile-First Approach for All Devices
 */

/* ========================================
   GLOBAL RESPONSIVE RESET
   ======================================== */

/* Mobile First - Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ========================================
   CONTAINER SYSTEM
   ======================================== */

.container {
    width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

/* Extra Small Devices (320px - 575px) */
@media (min-width: 320px) {
    .container {
        max-width: 300px;
        padding: 0 10px;
    }
}

/* Small Devices (576px - 767px) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
        padding: 0 15px;
    }
}

/* Medium Devices (768px - 991px) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding: 0 20px;
    }
}

/* Large Devices (992px - 1199px) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
        padding: 0 20px;
    }
}

/* Extra Large Devices (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
        padding: 0 20px;
    }
}

/* ========================================
   TYPOGRAPHY SYSTEM
   ======================================== */

/* Base Typography */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.875rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.625rem;
}

p {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Responsive Typography */
@media (min-width: 576px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    p { font-size: 0.9rem; }
}

@media (min-width: 768px) {
    h1 { font-size: 2.25rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.75rem; }
    h4 { font-size: 1.5rem; }
    p { font-size: 1rem; }
}

@media (min-width: 992px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 2rem; }
    h4 { font-size: 1.75rem; }
    p { font-size: 1rem; }
}

/* ========================================
   HEADER RESPONSIVE
   ======================================== */

/* Base Header */
.main-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    gap: 10px;
}

/* Extra Small Devices (320px - 575px) */
@media (max-width: 575px) {
    .header-top {
        flex-direction: column;
        padding: 15px 0;
        gap: 15px;
    }
    
    .header-left {
        width: 100%;
        text-align: center;
    }
    
    .header-center {
        width: 100%;
        order: 3;
    }
    
    .header-right {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .header-actions {
        justify-content: center;
        gap: 8px;
    }
    
    .login-link,
    .user-link,
    .cart-link {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 150px;
    }
}

/* Small Devices (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .header-top {
        padding: 12px 0;
        gap: 15px;
    }
    
    .header-center {
        flex: 1;
        max-width: 400px;
    }
    
    .logo h1 {
        font-size: 1.75rem;
    }
    
    .header-actions {
        gap: 10px;
    }
    
    .login-link,
    .user-link,
    .cart-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Medium Devices (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .header-top {
        padding: 15px 0;
    }
    
    .header-center {
        flex: 1;
        max-width: 500px;
    }
    
    .search-input {
        font-size: 0.9rem;
    }
    
    .header-actions {
        gap: 12px;
    }
}

/* ========================================
   NAVIGATION RESPONSIVE
   ======================================== */

/* Mobile Navigation */
.hamburger-menu {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
}

/* Hide hamburger on larger screens */
@media (min-width: 768px) {
    .hamburger-menu {
        display: none;
    }
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mobile-menu-content {
    padding: 20px;
}

.mobile-menu-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ========================================
   BUTTONS RESPONSIVE
   ======================================== */

.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.5;
}

/* Extra Small Devices */
@media (max-width: 575px) {
    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-group .btn {
        margin-bottom: 0;
    }
}

/* Small Devices */
@media (min-width: 576px) and (max-width: 767px) {
    .btn {
        padding: 12px 18px;
        font-size: 0.9rem;
    }
}

/* ========================================
   FORMS RESPONSIVE
   ======================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Extra Small Devices */
@media (max-width: 575px) {
    .form-control {
        padding: 14px 15px;
        font-size: 0.9rem;
    }
    
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* Small Devices and up */
@media (min-width: 576px) {
    .form-row {
        display: flex;
        gap: 1rem;
    }
    
    .form-row .form-group {
        flex: 1;
    }
}

/* ========================================
   CARDS RESPONSIVE
   ======================================== */

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.card-header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/* Extra Small Devices */
@media (max-width: 575px) {
    .card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-header {
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .card-title {
        font-size: 1.125rem;
    }
}

/* ========================================
   GRID SYSTEM
   ======================================== */

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    flex: 1;
    padding: 0 10px;
}

/* Extra Small Devices */
@media (max-width: 575px) {
    .row {
        margin: 0 -5px;
    }
    
    .col {
        padding: 0 5px;
        margin-bottom: 15px;
    }
    
    .col-12 {
        flex: 0 0 100%;
    }
    
    .col-6 {
        flex: 0 0 50%;
    }
    
    .col-4 {
        flex: 0 0 33.333%;
    }
    
    .col-3 {
        flex: 0 0 25%;
    }
}

/* Small Devices */
@media (min-width: 576px) and (max-width: 767px) {
    .col-sm-12 { flex: 0 0 100%; }
    .col-sm-6 { flex: 0 0 50%; }
    .col-sm-4 { flex: 0 0 33.333%; }
    .col-sm-3 { flex: 0 0 25%; }
}

/* Medium Devices */
@media (min-width: 768px) and (max-width: 991px) {
    .col-md-12 { flex: 0 0 100%; }
    .col-md-6 { flex: 0 0 50%; }
    .col-md-4 { flex: 0 0 33.333%; }
    .col-md-3 { flex: 0 0 25%; }
}

/* Large Devices */
@media (min-width: 992px) {
    .col-lg-12 { flex: 0 0 100%; }
    .col-lg-6 { flex: 0 0 50%; }
    .col-lg-4 { flex: 0 0 33.333%; }
    .col-lg-3 { flex: 0 0 25%; }
}

/* ========================================
   PRODUCT GRID RESPONSIVE
   ======================================== */

.product-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

/* Small Devices */
@media (min-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Medium Devices */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Large Devices */
@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
}

/* Extra Large Devices */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* ========================================
   TABLES RESPONSIVE
   ======================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

/* Extra Small Devices */
@media (max-width: 575px) {
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 8px 5px;
    }
    
    .hide-mobile {
        display: none;
    }
}

/* ========================================
   ALERTS RESPONSIVE
   ======================================== */

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Extra Small Devices */
@media (max-width: 575px) {
    .alert {
        padding: 12px;
        font-size: 0.85rem;
    }
}

/* ========================================
   FOOTER RESPONSIVE
   ======================================== */

.footer {
    background: #2c3e50;
    color: white;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    gap: 30px;
    grid-template-columns: 1fr;
}

.footer-section h4 {
    font-size: 1.125rem;
    margin-bottom: 15px;
    color: white;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

/* Small Devices */
@media (min-width: 576px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Medium Devices */
@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.d-none-mobile { display: block; }
.d-block-mobile { display: none; }

@media (max-width: 767px) {
    .d-none-mobile { display: none; }
    .d-block-mobile { display: block; }
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ========================================
   ANIMATIONS & TRANSITIONS
   ======================================== */

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.fade-in.active {
    opacity: 1;
    transform: translateY(0);
}

.slide-up {
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.slide-up.active {
    transform: translateY(0);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
.btn:focus,
.form-control:focus,
a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .header,
    .footer,
    .btn,
    .cart-actions {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}
