/* Responsive Styles */

/* Extra small devices (phones, 576px and down) */
@media (max-width: 576px) {
    :root {
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }
    
    .container {
        padding: 0 var(--space-md);
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    /* Dashboard */
    .dashboard-nav .container {
        padding: var(--space-sm) var(--space-md);
    }
    
    .user-btn span {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .dashboard-section {
        padding: var(--space-lg);
    }
    
    .activity-table th,
    .activity-table td {
        padding: var(--space-sm);
        font-size: 0.875rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    .plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-sidebar {
        display: flex !important;
    }
    
    .menu-toggle {
        display: none !important;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    .plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero .container {
        grid-template-columns: 1fr 1fr;
    }
    
    .auth-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .header-actions,
    .notifications-panel,
    .mobile-overlay {
        display: none !important;
    }
    
    .dashboard-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .dashboard-section {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
    
    a {
        color: black !important;
        text-decoration: none !important;
    }
    
    .btn {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --secondary: #00ffff;
        --dark: #000000;
        --light: #ffffff;
    }
    
    .gradient-text {
        color: var(--primary) !important;
        background: none !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-image img {
        transform: none !important;
    }
    
    .plan-card:hover {
        transform: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --dark: #f8fafc;
        --light: #1a1a2e;
        --gray-light: #2d2d44;
        --gray-dark: #e2e8f0;
    }
    
    body {
        background-color: var(--light);
        color: var(--dark);
    }
    
    .plan-card,
    .dashboard-section,
    .auth-card {
        background: var(--gray-light);
        color: var(--dark);
    }
    
    .form-control {
        background: var(--gray-light);
        border-color: var(--dark);
        color: var(--dark);
    }
    
    .activity-table th {
        background: var(--dark);
        color: var(--light);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-links a,
    .sidebar-menu a {
        padding: var(--space-lg) var(--space-md);
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    input,
    select,
    textarea {
        font-size: 16px;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .auth-section {
        min-height: 100vh;
        padding: var(--space-md) 0;
    }
    
    .dashboard-sidebar {
        height: 100vh;
        top: 0;
    }
    
    .dashboard-main {
        min-height: 100vh;
    }
}

/* Foldable Devices */
@media (max-width: 320px) {
    :root {
        --space-lg: 0.75rem;
        --space-xl: 1rem;
    }
    
    .logo span {
        font-size: 1.2rem;
    }
    
    .stat-card {
        padding: var(--space-md);
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* 4K and Large Screens */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    h1 {
        font-size: 3.5rem;
    }
    
    h2 {
        font-size: 2.5rem;
    }
    
    .hero-content h1 {
        font-size: 4rem;
    }
}

/* Grid System for Responsive Layouts */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: calc(var(--space-lg) * -1);
}

.col {
    flex: 1;
    padding: var(--space-lg);
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-4 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
    
    .col-md-8 {
        flex: 0 0 66.667%;
        max-width: 66.667%;
    }
}

@media (min-width: 992px) {
    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-lg-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }
}

/* Utility Classes */
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-column { flex-direction: column; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.rounded { border-radius: var(--radius-md); }
.rounded-circle { border-radius: 50%; }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.bg-white { background: white; }
.bg-dark { background: var(--dark); }
.bg-light { background: var(--light); }
.bg-primary { background: var(--primary); }

.text-white { color: white; }
.text-dark { color: var(--dark); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--gray); }

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Focus Styles for Accessibility */
:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: var(--space-md);
    text-decoration: none;
    z-index: 1001;
}

.skip-link:focus {
    top: 0;
}