/* Football App - Purple Theme with Collapsible Sidebar */
:root {
    --primary-purple: #6C3483;
    --light-purple: #BB8FCE;
    --hover-purple: #8E44AD;
    --sidebar-bg: #2C3E50;
    --sidebar-bg-dark: #34495E;
    --card-bg: #ffffff;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --border-color: #ECF0F1;
    --success-green: #27AE60;
    --danger-red: #E74C3C;
    
    /* Sidebar dimensions */
    --sidebar-width-expanded: 250px;
    --sidebar-width-collapsed: 70px;
    --transition-speed: 0.3s;
}

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

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #F8F9FA;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   APP CONTAINER - Flexbox Layout
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR - Collapsible (Desktop/Tablet)
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width-expanded);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-dark) 100%);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: width var(--transition-speed) ease;
    overflow: hidden;
}

/* Collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

/* ============================================
   SIDEBAR HEADER
   ============================================ */

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 80px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.brand-icon {
    font-size: 1.8rem;
    color: var(--light-purple);
    flex-shrink: 0;
}

.brand-text {
    white-space: nowrap;
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.brand-text h2 {
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.brand-text p {
    color: var(--light-purple);
    font-size: 0.8rem;
    margin: 2px 0 0;
}

/* Hide brand text when collapsed */
.sidebar.collapsed .brand-text {
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
}

/* ============================================
   SIDEBAR TOGGLE BUTTON
   ============================================ */

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle i {
    transition: transform var(--transition-speed) ease;
    font-size: 1rem;
}

/* Rotate arrow when collapsed */
.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Center toggle button when collapsed */
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 10px;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar-nav {
    list-style: none;
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    margin: 4px 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #BDC3C7;
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

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

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--hover-purple) 100%);
    color: white;
}

.nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    transition: margin var(--transition-speed) ease;
}

.nav-text {
    margin-left: 12px;
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
}

/* Collapsed state - hide text, center icons */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    position: absolute;
    transform: translateX(-10px);
    pointer-events: none;
}

.sidebar.collapsed .nav-item {
    margin: 4px 8px;
}

/* Tooltip for collapsed state */
.sidebar.collapsed .nav-link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   USER INFO SECTION
   ============================================ */

.user-info {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.user-details {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.user-avatar-placeholder {
    background-color: var(--primary-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.user-text {
    overflow: hidden;
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.user-name {
    color: white;
    font-weight: 600;
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    color: var(--light-purple);
    font-size: 0.75rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Logout button */
.logout-form {
    margin: 0;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--danger-red) 0%, #C0392B 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-logout i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Collapsed user info */
.sidebar.collapsed .user-details {
    justify-content: center;
}

.sidebar.collapsed .user-text {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.sidebar.collapsed .user-info {
    padding: 15px 8px;
}

.sidebar.collapsed .btn-logout {
    padding: 10px;
}

.sidebar.collapsed .btn-logout .nav-text {
    display: none;
}

/* Tooltip for logout button when collapsed */
.sidebar.collapsed .btn-logout {
    position: relative;
}

.sidebar.collapsed .btn-logout::after {
    content: "Logout";
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed .btn-logout:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width-expanded);
    padding: 30px;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease;
}

/* Adjust when sidebar is collapsed */
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--hover-purple) 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(108, 52, 131, 0.2);
}

.page-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.page-header p {
    margin: 10px 0 0;
    opacity: 0.9;
    font-size: 1rem;
}

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

.card {
    background: var(--card-bg);
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--hover-purple) 100%);
    color: white;
    border: none;
    border-radius: 12px 12px 0 0 !important;
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 25px;
}

/* Stats Cards */
.stats-card {
    text-align: center;
    padding: 25px;
}

.stats-card .icon {
    font-size: 2.5rem;
    color: var(--primary-purple);
    margin-bottom: 15px;
}

.stats-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.stats-card .label {
    color: var(--text-light);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-card .change {
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.stats-card .change.positive {
    color: var(--success-green);
}

.stats-card .change.negative {
    color: var(--danger-red);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--hover-purple) 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px rgba(108, 52, 131, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 52, 131, 0.3);
    background: linear-gradient(135deg, var(--hover-purple) 0%, var(--primary-purple) 100%);
}

.btn-secondary {
    background-color: #95A5A6;
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-weight: 600;
}

.btn-success {
    background: linear-gradient(135deg, #27AE60 0%, #229954 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-weight: 600;
}

.btn-danger {
    background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-weight: 600;
}

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

.table {
    border-collapse: separate;
    border-spacing: 0;
}

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

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(108, 52, 131, 0.05);
}

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

.table-responsive {
    border-radius: 12px;
    overflow: hidden;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.badge-dark {
    background-color: #2C3E50;
}

.badge-light {
    background-color: #ECF0F1;
    color: var(--text-dark);
}

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

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

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

.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: border-color var(--transition-speed) ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 0.2rem rgba(108, 52, 131, 0.15);
}

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

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

.alert {
    border: none;
    border-radius: 8px;
    padding: 15px 20px;
}

.alert-success {
    background-color: rgba(39, 174, 96, 0.1);
    color: var(--success-green);
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--danger-red);
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner-border {
    color: var(--primary-purple);
}

/* ============================================
   CHART CONTAINERS
   ============================================ */

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 20px;
}

/* ============================================
   TEAM ROSTER
   ============================================ */

.team-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.team-roster .player-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    text-align: center;
    transition: all var(--transition-speed) ease;
}

.team-roster .player-card:hover {
    border-color: var(--primary-purple);
    transform: translateY(-3px);
}

.team-roster .player-card.goalkeeper {
    border-color: var(--primary-purple);
    background: linear-gradient(135deg, rgba(108, 52, 131, 0.05) 0%, rgba(187, 143, 206, 0.05) 100%);
}

.team-roster .player-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.team-roster .player-points {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ============================================
   POINTS DISPLAY
   ============================================ */

.points-positive {
    color: var(--success-green);
    font-weight: 700;
}

.points-negative {
    color: var(--danger-red);
    font-weight: 700;
}

.points-neutral {
    color: var(--text-light);
    font-weight: 700;
}

/* ============================================
   MOBILE MENU BUTTON (hidden by default)
   ============================================ */

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1002;
    background: var(--primary-purple);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-speed) ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-menu-btn:hover {
    background: var(--hover-purple);
}

.mobile-menu-btn i {
    font-size: 1.3rem;
}

/* ============================================
   SIDEBAR OVERLAY (for mobile)
   NOTE: Overlay is created/removed by JS only when needed
   This prevents iOS touch issues
   ============================================ */

.sidebar-overlay {
    /* Styles are applied inline by JS when overlay is created */
}

/* Body state when mobile sidebar is open */
body.mobile-sidebar-open {
    overflow: hidden !important;
}

/* ============================================
   iOS TOUCH FIXES - GLOBAL
   ============================================ */

/* Make all clickable elements work on iOS */
a,
button,
.btn,
[role="button"],
input[type="submit"],
input[type="button"] {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(108, 52, 131, 0.3);
    touch-action: manipulation;
}

/* Prevent text selection on buttons during tap */
button,
.btn {
    -webkit-user-select: none;
    user-select: none;
}

/* Fix for iOS not firing click events on non-anchor elements */
.table .btn-group .btn {
    cursor: pointer;
}

/* ============================================
   RESPONSIVE DESIGN - TABLET (768px - 991px)
   ============================================ */

@media (max-width: 991.98px) {
    .page-header {
        padding: 20px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .card-body {
        padding: 20px;
    }

    .stats-card .number {
        font-size: 2rem;
    }

    .stats-card .icon {
        font-size: 2rem;
    }

    .main-content {
        padding: 20px;
    }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE (<768px)
   ============================================ */

@media (max-width: 767.98px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }

    /* Overlay is handled entirely by JavaScript - no CSS needed */

    /* Sidebar becomes a slide-out drawer */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width-expanded) !important;
    }

    /* When sidebar is open on mobile */
    .sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Hide the collapse toggle on mobile */
    .sidebar-toggle {
        display: none;
    }

    /* ========================================
       MOBILE SIDEBAR HEADER - Stack vertically
       ======================================== */
    .sidebar.mobile-open .sidebar-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        min-height: auto;
        position: relative;
    }

    /* Mobile close button - top right corner */
    .sidebar.mobile-open .sidebar-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
    }

    /* Brand section below close button area */
    .sidebar.mobile-open .sidebar-brand {
        margin-top: 50px; /* Space for close button */
        width: 100%;
    }

    /* Always show full sidebar content on mobile when open */
    .sidebar.mobile-open .brand-text,
    .sidebar.mobile-open .nav-text,
    .sidebar.mobile-open .user-text {
        opacity: 1;
        transform: none;
        position: relative;
        pointer-events: auto;
    }

    .sidebar.mobile-open .nav-link {
        justify-content: flex-start;
        padding: 12px 15px;
    }

    .sidebar.mobile-open .user-details {
        justify-content: flex-start;
    }

    .sidebar.mobile-open .btn-logout .nav-text {
        display: inline;
    }

    /* Main content full width on mobile */
    .main-content {
        margin-left: 0 !important;
        padding: 15px;
        padding-top: 70px; /* Space for mobile menu button */
    }

    /* Override collapsed state on mobile */
    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .page-header {
        padding: 15px;
        border-radius: 8px;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .card {
        margin-bottom: 15px;
    }

    .card-header {
        padding: 15px;
        font-size: 1rem;
    }

    .card-body {
        padding: 15px;
    }

    .stats-card .number {
        font-size: 1.75rem;
    }

    .chart-container {
        height: 250px;
    }

    .team-roster {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    /* Disable tooltips on mobile */
    .sidebar .nav-link::after,
    .sidebar .btn-logout::after {
        display: none;
    }

    /* ========================================
       MOBILE-FRIENDLY ACTION BUTTONS IN TABLES
       iOS Safari compatible with proper touch handling
       ======================================== */
    
    /* Make action buttons larger and more tappable on mobile */
    .table .btn-group {
        display: flex;
        flex-direction: row;
        gap: 8px;
    }

    .table .btn-group .btn,
    .table .btn-group .btn-sm,
    .table .btn-group-sm .btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 1.1rem;
        border-radius: 8px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        /* iOS Safari touch fixes */
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(108, 52, 131, 0.3);
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
    }

    /* Remove the connected button look on mobile */
    .table .btn-group > .btn:not(:last-child),
    .table .btn-group > .btn-group:not(:last-child) > .btn {
        border-top-right-radius: 8px !important;
        border-bottom-right-radius: 8px !important;
    }

    .table .btn-group > .btn:not(:first-child),
    .table .btn-group > .btn-group:not(:first-child) > .btn {
        border-top-left-radius: 8px !important;
        border-bottom-left-radius: 8px !important;
        margin-left: 0;
    }

    /* Make icons inside buttons larger */
    .table .btn-group .btn i {
        font-size: 1.2rem;
        pointer-events: none; /* Let the button handle clicks, not the icon */
    }

    /* Ensure buttons have visible colors and higher z-index */
    .table .btn-outline-info {
        border-color: #17a2b8;
        color: #17a2b8;
        background-color: rgba(23, 162, 184, 0.15);
        position: relative;
        z-index: 1;
    }

    .table .btn-outline-primary {
        border-color: var(--primary-purple);
        color: var(--primary-purple);
        background-color: rgba(108, 52, 131, 0.15);
        position: relative;
        z-index: 1;
    }

    .table .btn-outline-secondary {
        border-color: #6c757d;
        color: #6c757d;
        background-color: rgba(108, 117, 125, 0.15);
        position: relative;
        z-index: 1;
    }

    .table .btn-outline-danger {
        border-color: var(--danger-red);
        color: var(--danger-red);
        background-color: rgba(231, 76, 60, 0.15);
        position: relative;
        z-index: 1;
    }

    /* Active/pressed state for touch feedback */
    .table .btn-group .btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* Extra small screens - stack buttons vertically if needed */
@media (max-width: 480px) {
    /* Stack action buttons if needed */
    .table .btn-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Make action column wider on small screens */
    .table td:last-child {
        min-width: 150px;
    }
}

@media (max-width: 576px) {
    html {
        font-size: 13px;
    }

    .stats-card {
        padding: 15px;
    }

    .stats-card .icon {
        font-size: 1.75rem;
        margin-bottom: 10px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .table thead th,
    .table tbody td {
        padding: 10px;
        font-size: 0.85rem;
    }

    /* Ensure action buttons remain tappable even with smaller table cells */
    .table .btn-group .btn,
    .table .btn-group .btn-sm {
        min-width: 40px;
        min-height: 40px;
        padding: 8px 10px;
    }
}

/* ============================================
   iOS SAFARI SPECIFIC FIXES
   ============================================ */

/* Fix for iOS not recognizing clicks on certain elements */
@supports (-webkit-touch-callout: none) {
    /* iOS only */
    .btn,
    .btn-group .btn,
    a.btn,
    a[class*="btn-"] {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(108, 52, 131, 0.3);
        touch-action: manipulation;
    }

    /* Ensure links in tables are clickable */
    .table a,
    .table button,
    .table .btn {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(108, 52, 131, 0.3);
        touch-action: manipulation;
        -webkit-user-select: none;
    }

    /* Make sure table action buttons have proper stacking */
    .table .btn-group {
        position: relative;
        z-index: 5;
    }

    .table .btn-group .btn {
        position: relative;
        z-index: 6;
    }
}

/* Visual feedback when touching buttons on mobile */
.btn.touching,
.table .btn.touching {
    opacity: 0.7;
    transform: scale(0.95);
}

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

.nav-link:focus,
.btn:focus,
.sidebar-toggle:focus,
.mobile-menu-btn:focus {
    outline: 2px solid var(--light-purple);
    outline-offset: 2px;
}

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

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

@media print {
    .sidebar,
    .mobile-menu-btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        break-inside: avoid;
    }
}
