/* ===================================
   Responsive Design - Mobile First
   =================================== */

/* ===================================
   Tablet (768px and below)
   =================================== */

@media (max-width: 768px) {
    /* Header */
    .logo h1 {
        font-size: 1.2rem;
    }

    .menu-toggle {
        display: block;
    }

    /* Navigation */
    .app-nav {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 60px);
        background-color: var(--surface);
        box-shadow: var(--shadow-lg);
        transition: left var(--transition-normal);
        overflow-y: auto;
        z-index: 98;
    }

    .app-nav.active {
        left: 0;
    }

    .nav-list {
        flex-direction: column;
    }

    .nav-item {
        justify-content: flex-start;
        padding: var(--spacing-lg);
        border-bottom: 1px solid var(--border-color);
        border-left: 3px solid transparent;
    }

    .nav-item.active {
        border-bottom-color: var(--border-color);
        border-left-color: var(--primary-color);
    }

    /* Main Content */
    .app-main {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .screen-content {
        padding: var(--spacing-lg);
    }

    /* Forms */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tables */
    .table-controls {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .filter-controls {
        width: 100%;
    }

    .filter-controls select,
    .filter-controls input {
        flex: 1;
        min-width: 0;
    }

    /* Make tables scrollable on mobile */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 800px;
    }

    th, td {
        padding: var(--spacing-sm);
        font-size: 0.9rem;
    }

    /* Competition Cards */
    .competitions-grid {
        grid-template-columns: 1fr;
    }

    /* Stats Cards */
    .stats-summary {
        grid-template-columns: 1fr;
    }

    /* Classification Levels */
    .classification-levels {
        grid-template-columns: 1fr;
    }

    /* Chart */
    .chart-container canvas {
        max-height: 300px;
    }

    /* Footer */
    .footer-content {
        font-size: 0.85rem;
    }
}

/* ===================================
   Mobile (480px and below)
   =================================== */

@media (max-width: 480px) {
    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    /* Header */
    .logo h1 {
        font-size: 1rem;
    }

    .logo i {
        font-size: 1.5rem;
    }

    /* Screen Header */
    .screen-header h2 {
        font-size: 1.3rem;
    }

    .screen-header p {
        font-size: 0.9rem;
    }

    /* Forms */
    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group select {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.95rem;
    }

    /* Buttons */
    .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.95rem;
    }

    /* Competition Cards */
    .competition-card {
        padding: var(--spacing-md);
    }

    .competition-card-header i {
        font-size: 1.5rem;
    }

    .competition-card-title h3 {
        font-size: 1.1rem;
    }

    /* Stats Cards */
    .stat-card i {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    /* Current Handicap */
    .current-handicap {
        flex-direction: column;
        text-align: center;
    }

    .current-handicap i {
        font-size: 2.5rem;
    }

    .current-handicap .value {
        font-size: 1.75rem;
    }

    /* Filter Controls */
    .filter-controls {
        flex-direction: column;
    }

    .filter-controls select,
    .filter-controls input {
        width: 100%;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }

    .pagination .btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.85rem;
    }

    #pageInfo {
        width: 100%;
        text-align: center;
        margin: var(--spacing-sm) 0;
    }
}

/* ===================================
   Large Screens (1200px and above)
   =================================== */

@media (min-width: 1200px) {
    /* Increase max-width for larger screens */
    .app-main {
        max-width: 1600px;
    }

    /* Competition Cards - 3 columns */
    .competitions-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Stats Cards - 4 columns if more than 3 */
    .stats-summary {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    /* Classification Levels - 4 columns */
    .classification-levels {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    /* Hide non-essential elements */
    .app-header,
    .app-nav,
    .app-footer,
    .menu-toggle,
    .table-controls,
    .filter-controls,
    .form-actions,
    .action-buttons,
    .btn,
    .pagination {
        display: none !important;
    }

    /* Adjust layout for print */
    body {
        background-color: white;
    }

    .app-main {
        padding: 0;
        max-width: 100%;
    }

    .screen-content {
        box-shadow: none;
        padding: 0;
    }

    /* Tables */
    table {
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    tr {
        page-break-inside: avoid;
    }

    /* Competition Cards */
    .competition-card {
        page-break-inside: avoid;
        border: 1px solid #000;
    }

    /* Charts - hide canvas, show data table instead */
    .chart-container {
        display: none;
    }
}

/* ===================================
   Accessibility Improvements
   =================================== */

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000000;
        --text-primary: #000000;
        --background: #ffffff;
        --surface: #ffffff;
        --border-color: #000000;
    }

    .btn-primary {
        border: 2px solid #000000;
    }

    table {
        border: 2px solid #000000;
    }

    th, td {
        border: 1px solid #000000;
    }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1a1a1a;
        --surface: #2c2c2c;
        --surface-dark: #3a3a3a;
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --text-light: #808080;
        --border-color: #404040;
    }

    .app-header {
        background: linear-gradient(135deg, #1a3009 0%, #2d5016 100%);
    }

    .app-nav {
        background-color: var(--surface);
    }

    .screen-content {
        background-color: var(--surface);
    }

    table {
        background-color: var(--surface);
    }

    tbody tr:hover {
        background-color: var(--surface-dark);
    }
}

/* ===================================
   Landscape Orientation (Mobile)
   =================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .app-nav {
        width: 240px;
    }

    .nav-item {
        padding: var(--spacing-md);
    }

    .nav-item span {
        font-size: 0.9rem;
    }
}

/* ===================================
   Touch Device Optimizations
   =================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .nav-item,
    .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-item:hover,
    .competition-card:hover {
        transform: none;
    }

    /* Add active states instead */
    .btn:active {
        transform: scale(0.98);
    }

    .nav-item:active {
        background-color: var(--surface-dark);
    }
}

/* Made with Bob */
