/* HerenGolf Modern Theme - Fase 3 Implementation */

:root {
    --hg-primary: #2E7D32; /* Golf green */
    --hg-secondary: #FFC107; /* Golf yellow */
    --hg-success: #4CAF50;
    --hg-info: #2196F3;
    --hg-warning: #FF9800;
    --hg-danger: #F44336;
    --hg-light: #F8F9FA;
    --hg-dark: #1B5E20;
    --hg-gradient: linear-gradient(135deg, #e2e8e0 0%, #e2e8e0 0%);
}

.herengolf-theme {
    --bs-primary: var(--hg-primary);
    --bs-secondary: var(--hg-secondary);
}

/* Enhanced Golf Background */
.golf-background {
    background: var(--hg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
}

.main-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin: 20px;
    padding: 30px;
}

/* Modern Navigation */
.navbar-golf {
    background: var(--hg-gradient) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1030;
}

.navbar-golf .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: rebeccapurple !important;
}

.navbar-golf .nav-link {
    color: rebeccapurple !important;
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-golf .nav-link:hover {
    color: var(--hg-secondary) !important;
    transform: translateY(-2px);
}

/* Admin Dropdown Fixes */
.navbar-golf .dropdown {
    position: relative;
}

.navbar-golf .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 1050;
    min-width: 220px;
    padding: 0.75rem 0;
    margin: 0.125rem 0 0;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    background-clip: padding-box;
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(10px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.navbar-golf .dropdown.show .dropdown-menu {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.navbar-golf .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    clear: both;
    font-weight: 500;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    transition: all 0.2s ease;
}

.navbar-golf .dropdown-item:hover,
.navbar-golf .dropdown-item:focus {
    color: white;
    background: var(--hg-gradient);
    border-radius: 8px;
    margin: 0 8px;
    transform: translateX(4px);
}

.navbar-golf .dropdown-item i {
    width: 20px;
    text-align: center;
}

.navbar-golf .dropdown-divider {
    height: 0;
    margin: 0.5rem 1rem;
    overflow: hidden;
    border-top: 1px solid rgba(46, 125, 50, 0.2);
}

/* Ensure dropdown doesn't get cut off on mobile */
@media (max-width: 991.98px) {
    .navbar-golf .dropdown-menu {
        position: static;
        display: none;
        float: none;
        width: 100%;
        margin-top: 0;
        background-color: rgba(255, 255, 255, 0.95);
        border: none;
        border-radius: 8px;
        box-shadow: none;
        transform: none;
        opacity: 1;
        visibility: visible;
    }
    
    .navbar-golf .dropdown.show .dropdown-menu {
        display: block;
    }
    
    .navbar-golf .dropdown-item {
        padding: 0.75rem 1rem;
    }
}

/* Fix for container overflow */
.container-fluid {
    position: relative;
    overflow: visible;
}

.navbar-collapse {
    z-index: 1040;
}

/* Navbar dropdown toggle styling */
.navbar-golf .dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.255em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

.navbar-golf .dropdown-toggle:empty::after {
    margin-left: 0;
}

/* Enhanced Cards */
.card-modern {
    border: none;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-modern:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.card-header-golf {
    background: var(--hg-gradient);
    color: rebeccapurple;
    border: none;
    padding: 20px;
}

.card-header-golf h1,
.card-header-golf h2,
.card-header-golf h3,
.card-header-golf h4,
.card-header-golf h5 {
    margin: 0;
    font-weight: 600;
}

/* Modern Table Styling */
.table-golf {
    background: var(--hg-gradient);
    color: white;
}

.table-golf th {
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.table-responsive-stack {
    border: none;
}

/* Mobile Leaderboard Cards */
.leaderboard-item {
    border: 1px solid #e9ecef;
    border-radius: 15px;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
    margin-bottom: 1rem;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

/* Player name styling */
.player-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    text-decoration: none;
}

.player-name:hover {
    color: var(--hg-primary);
}

/* Score display */
.main-score {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--hg-primary);
    line-height: 1;
}

/* Player details row */
.player-details {
    font-size: 0.9rem;
    gap: 0.5rem;
}

.player-details .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Achievement badges - mobile specific */
@media (max-width: 768px) {
    .achievement-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
        border-radius: 10px;
        white-space: nowrap;
        margin: 0.1rem;
    }
    
    .achievement-badge.birdy {
        background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
        color: #2e7d32;
        border: 1px solid #4caf50;
    }
    
    .achievement-badge.eagle {
        background: linear-gradient(135deg, #fff3e0, #ffe0b2);
        color: #ef6c00;
        border: 1px solid #ff9800;
    }
    
    .achievement-badge.longest {
        background: linear-gradient(135deg, #e3f2fd, #bbdefb);
        color: #1565c0;
        border: 1px solid #2196f3;
    }
    
    .achievement-badge.neary {
        background: linear-gradient(135deg, #f3e5f5, #e1bee7);
        color: #7b1fa2;
        border: 1px solid #9c27b0;
    }
    
    .achievement-badge.leary {
        background: linear-gradient(135deg, #fce4ec, #f8bbd9);
        color: #c2185b;
        border: 1px solid #e91e63;
    }
    
    .achievement-badge.slice {
        background: linear-gradient(135deg, #fff8e1, #ffecb3);
        color: #ff8f00;
        border: 1px solid #ffc107;
    }
}

/* Mobile-First Responsive Tables - Legacy for old browsers */
@media (max-width: 768px) {
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tr {
        display: block;
        border: 1px solid #e0e0e0;
        margin-bottom: 15px;
        border-radius: 12px;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        overflow: hidden;
    }
    
    .table-responsive-stack td {
        display: block;
        text-align: right;
        border: none;
        padding: 12px 20px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table-responsive-stack td:last-child {
        border-bottom: none;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label) ": ";
        float: left;
        font-weight: bold;
        color: var(--hg-primary);
    }
    
    .table-responsive-stack .ranking-cell {
        background: var(--hg-gradient);
        color: white;
        text-align: center;
        font-size: 1.2rem;
        font-weight: bold;
    }
    
    .table-responsive-stack .ranking-cell:before {
        display: none;
    }
}

/* Enhanced Ranking Badges */
.ranking-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.ranking-badge.top-1 {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    animation: pulse-gold 2s infinite;
}

.ranking-badge.top-2 {
    background: linear-gradient(135deg, #C0C0C0, #808080);
}

.ranking-badge.top-3 {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
}

.ranking-badge.regular {
    background: var(--hg-gradient);
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

/* Score Cards for Wedstrijden */
.score-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.score-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.score-card-header {
    background: var(--hg-gradient);
    color: white;
    padding: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Badges */
.badge-golf {
    background: var(--hg-gradient);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 600;
}

/* Achievement Badges - Consistent styling for all pages */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #e4f7e3, #e4f7e3);
    color: #116800;
    font-size: 0.8rem;
    padding: 0.1rem 0.4rem;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0.1rem;
}

.achievement-badge.longest {
    background: linear-gradient(135deg, #e3eaf7, #cfdcf7);
    color: #1565C0;
}

.achievement-badge.neary {
    background: linear-gradient(135deg, #f6f7e3, #f6f7cf);
    color: #212529;
}

.achievement-badge.leary {
    background: linear-gradient(135deg, #eee3f7, #d2e6f7);
    color: #6A1B9A;
}

.achievement-badge.birdy {
    background: linear-gradient(135deg, #f7c2b8, #f2c496);
    color: #2E7D32;
}

.achievement-badge.eagle {
    background: linear-gradient(135deg, #f7c2b8, #f2c496);
    color: #F57C00;
}

/* Legacy badge classes for backward compatibility */
.badge-birdie {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
}

.badge-eagle {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.badge-longest {
    background: linear-gradient(135deg, #2196F3, #1565C0);
    color: white;
}

.badge-neary {
    background: linear-gradient(135deg, #9C27B0, #6A1B9A);
    color: white;
}

.badge-leary {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

/* Photo Gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.photo-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-item:hover {
    transform: scale(1.05);
}

.photo-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    transition: all 0.3s ease;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(46, 125, 50, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 15px;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay i {
    color: white;
    font-size: 2rem;
}

/* Modern Buttons */
.btn-golf {
    background: var(--hg-gradient);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-golf:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(46, 125, 50, 0.3);
    color: white;
}

.btn-outline-golf {
    border: 2px solid var(--hg-primary);
    color: var(--hg-primary);
    background: transparent;
    padding: 10px 22px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-golf:hover {
    background: var(--hg-gradient);
    color: white;
    transform: translateY(-2px);
}

/* Upload Dropzone */
.dropzone-area {
    border: 3px dashed var(--hg-primary);
    border-radius: 15px;
    background: rgba(46, 125, 50, 0.05);
    transition: all 0.3s ease;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-area.drag-over {
    border-color: var(--hg-secondary);
    background: rgba(255, 193, 7, 0.1);
    transform: scale(1.02);
}

.dropzone-content {
    text-align: center;
    padding: 40px;
}

.dropzone-content i {
    color: var(--hg-primary);
}

/* Progress Items */
.progress-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(46, 125, 50, 0.3);
    border-radius: 50%;
    border-top-color: var(--hg-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Statistics Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Alert Styles */
.alert-golf {
    border: none;
    border-radius: 15px;
    border-left: 5px solid var(--hg-primary);
    background: rgba(46, 125, 50, 0.1);
    color: var(--hg-dark);
}

/* Footer */
.footer-golf {
    background: var(--hg-gradient);
    color: rebeccapurple;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-golf a {
    color: var(--hg-secondary);
    text-decoration: none;
}

.footer-golf a:hover {
    color: white;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Print Styles */
@media print {
    .golf-background {
        background: white !important;
    }
    
    .main-content {
        background: white !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 20px !important;
    }
    
    .navbar-golf,
    .btn,
    .card-header-golf {
        background: white !important;
        color: black !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .main-content {
        background: rgba(33, 37, 41, 0.95);
        color: white;
    }
    
    .card-modern {
        background: #2d3748;
        color: white;
    }
    
    .table-responsive-stack tr {
        background: #2d3748;
        color: white;
        border-color: #4a5568;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
.btn-golf:focus,
.btn-outline-golf:focus {
    outline: 3px solid var(--hg-secondary);
    outline-offset: 2px;
}

/* Admin Authentication Indicator */
.navbar-golf .nav-item.dropdown .nav-link {
    position: relative;
}

.navbar-golf .nav-item.dropdown .nav-link::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--hg-secondary);
    border-radius: 50%;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
    
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --hg-primary: #000000;
        --hg-secondary: #ffffff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Additional Standings Page Improvements */

/* Medal and Position Styling */
.position-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
}

/* Mobile Medal Display */
@media (max-width: 768px) {
    .leaderboard-item .position-medal {
        min-width: 3rem;
        height: auto;
        font-size: 2rem;
    }
    
    /* Ensure medals are always visible */
    .leaderboard-item {
        min-height: 80px;
        display: flex;
        align-items: center;
    }
    
    /* Player name link styling */
    .player-name {
        color: #2c3e50;
        font-size: 1.1rem;
        font-weight: 600;
        line-height: 1.3;
    }
    
    .player-name:hover {
        color: var(--hg-primary);
        text-decoration: none;
    }
    
    /* Score display improvements */
    .main-score {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--hg-primary);
        line-height: 1;
    }
    
    .score-display {
        flex-shrink: 0;
        min-width: 4rem;
    }
    
    /* Ensure proper flex alignment in leaderboard items */
    .leaderboard-item .d-flex {
        width: 100%;
    }
    
    .player-name-section {
        min-width: 0; /* Allow text truncation if needed */
    }
    
    /* Better spacing for player details */
    .player-details {
        margin-top: 0.5rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        align-items: center;
    }
    
    /* HCP Badge styling */
    .player-details .badge {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
    }
    
    /* Ensure badges don't break layout */
    .player-details .badge,
    .player-details .achievement-badge {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Desktop table improvements */
@media (min-width: 769px) {
    .table-standings tbody tr:hover {
        background-color: rgba(46, 125, 50, 0.05);
        transform: translateX(5px);
        transition: all 0.2s ease;
    }
    
    .table-standings .achievement-badge {
        font-size: 0.75rem;
        margin: 0.1rem;
    }
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
    .main-score {
        font-size: 1.3rem;
    }
    
    .player-name {
        font-size: 1rem;
    }
    
    .achievement-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
    }
    
    .leaderboard-item {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
}

/* Ensure consistent spacing */
.min-width-0 {
    min-width: 0;
}

.flex-grow-1 {
    flex-grow: 1;
}