/* Cricket Team Generator - Enhanced Dynamic Styles */

/* Import and Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;   /* ALWAYS visible by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    display: none;   /* hide properly */
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification.success {
    border-left: 4px solid #27ae60;
}

.notification.error {
    border-left: 4px solid #e74c3c;
}

.notification.info {
    border-left: 4px solid #3498db;
}

.notification.warning {
    border-left: 4px solid #f39c12;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Main Container */
.container {
    display: flex;
    width: 100%;
    height: 100vh;
    gap: 2px;
    padding: 4px;
}

/* Panel Styles */
.left-panel,
.right-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.left-panel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 8px);
    overflow-y: auto; /* Allow scrolling for full lineup visibility */
}

.right-panel {
    padding: 20px;
}

/* Panel Headers */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

.panel-header h1 {
    color: #2c3e50;
    font-size: 1.6em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.header-controls{
    display:flex;
    align-items:center;
    gap:6px;
}

.platform-select{
    width:120px;
    height:38px;
}

.refresh-btn{
    width:38px;
    height:38px;
}
.panel-actions {
    display: flex;
    gap: 8px;
}

.refresh-btn,
.clear-btn,
.export-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn {
    background: #3498db;
    color: white;
}

.refresh-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.clear-btn {
    background: #e74c3c;
    color: white;
}

.clear-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.export-btn {
    background: #27ae60;
    color: white;
}

.export-btn:hover {
    background: #229954;
    transform: translateY(-1px);
}

/* Status Indicator */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

.status-working {
    background-color: #27ae60;
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
}

.status-error {
    background-color: #e74c3c;
    box-shadow: 0 0 6px rgba(231, 76, 60, 0.6);
}

.status-loading {
    background-color: #f39c12;
    box-shadow: 0 0 6px rgba(243, 156, 18, 0.6);
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Enhanced Dropdown Styles */
.top-dropdowns {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.schedule-dropdown-container {
    position: relative;
    margin-bottom: 20px;
}

.dynamic-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease; /* Removed transform to avoid issues with native dropdowns */
    min-width: 120px;
    position: relative;
    width: 100%;
    appearance: auto; /* Ensure native dropdown behavior for keyboard navigation */
}

.dynamic-select:hover {
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.dynamic-select:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.dynamic-select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

/* New Filter Container Layout */
#filter-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.filter-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-display {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: 1px solid #0984e3;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(9, 132, 227, 0.3);
    font-weight: 600;
    font-size: 14px;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading States */
.dropdown-loading,
.table-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mini-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.table-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
}

/* Enhanced Table Styles */
.lineup-section {
    display: flex;
    margin-top: 15px;
    flex: 1;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    justify-content: space-between;
    gap: 12px;
    min-height: 300px;
}

.batting-order {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.table-header h2 {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.player-count-badge {
    background: #27ae60;
    color: white;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.table-container {
    position: relative;
    flex: 1;
    overflow: visible !important;
    min-height: 250px;
    height: auto !important;
    max-height: none !important;
}

.dynamic-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 11px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 100%;
}

.dynamic-table th,
.dynamic-table td {
    border: 1px solid #e0e0e0;
    padding: 6px 4px;
    text-align: center;
    word-wrap: break-word;
}

.dynamic-table td:first-child {
    text-align: left;
    font-weight: 600;
    width: 35%;
}

.dynamic-table th:nth-child(1),
.dynamic-table td:nth-child(1) {
    width: 35%;
}

.dynamic-table th:nth-child(2),
.dynamic-table td:nth-child(2) {
    width: 15%;
}

.dynamic-table th:nth-child(3),
.dynamic-table td:nth-child(3) {
    width: 15%;
}

.dynamic-table th:nth-child(4),
.dynamic-table td:nth-child(4) {
    width: 17.5%;
}

.dynamic-table th:nth-child(5),
.dynamic-table td:nth-child(5) {
    width: 17.5%;
}

.dynamic-table thead {
    background: linear-gradient(135deg, #fdcb6e, #e17055);
    color: white;
    font-weight: 600;
    font-size: 10px;
}

.dynamic-table tbody {
    overflow-y: auto;
}

.dynamic-table tbody tr {
    transition: all 0.2s ease;
}

.dynamic-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.dynamic-table tbody tr:hover {
    background-color: #e3f2fd;
    transform: scale(1.01);
}

/* Total Teams Box */
.new-total-teams-box {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.new-total-teams-box h2 {
    font-size: 1.1em;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-total-teams-box p {
    font-size: 2em;
    font-weight: 700;
    color: #f1c40f;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    .left-panel, .right-panel {
        height: auto;
        overflow: visible;
    }
    #filter-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    #filter-container {
        grid-template-columns: repeat(2, 1fr);
    }
    .lineup-section {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    #filter-container {
        grid-template-columns: 1fr;
    }
}

/* Override height and overflow for batting section and lineup container */
#batting-section, 
#lineup-container,
.lineup-section {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Final Layout Overrides */
.table-container {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

#lineup-section, .lineup-section {
    height: auto !important;
    overflow: visible !important;
}

.total-box {
    position: relative !important;
    padding: 10px 15px;
    border-radius: 10px;
}

.total-box h2 {
    font-size: 14px;
    margin-bottom: 5px;
}

.total-box h1 {
    font-size: 24px;
    margin: 0;
}


/* Top 3 dropdowns in one line */
.horizontal-row {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.horizontal-row select {
    flex: 1;
    min-width: 0;
}

/* Schedule full width below */
.full-width {
    width: 50%;
}

.full-width select {
    width: 50%;
}

@media (max-width: 768px) {
    .horizontal-row {
        flex-direction: column;
    }
}

/* New Styles for Teams and Button */
#teams-container {
    margin-top: 10px;
}

/* Button */
#create-teams-btn {
    width: 100%;
    padding: 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    margin-top: 10px;
}
#create-teams-btn:disabled {
    background: #ccc;
}

/* Team Card */
.team-card {
    background: #1e7f4f;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    color: white;
}

/* Header */
.team-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

/* Section */
.role-title {
    text-align: center;
    font-size: 11px;
    margin: 6px 0;
    opacity: 0.8;
}

.players-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.player {
    text-align: center;
    width: 60px;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    background: #ccc;
    border-radius: 50%;
    margin: auto;
}

.name {
    font-size: 10px;
}

.credit {
    font-size: 10px;
    opacity: 0.8;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}
from pathlib import Path

css = r"""
/* ===== PREMIUM UI OVERRIDES - ADD AT END OF style.css ===== */

body{
    background: radial-gradient(circle at top left,#1e3c72,#0f172a 70%) !important;
}

.left-panel,
.right-panel{
    background: rgba(255,255,255,0.08) !important;
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.15) !important;
}

.panel-header h1,
.table-header h2,
.total-box h2,
#totalTeams{
    color:#fff !important;
}

.dynamic-select{
    background:#111827 !important;
    color:#fff !important;
    border:1px solid #374151 !important;
}

.dynamic-select:hover{
    border-color:#00d4ff !important;
    box-shadow:0 0 12px rgba(0,212,255,.25);
}

.dynamic-select:focus{
    box-shadow:0 0 15px rgba(0,212,255,.4) !important;
}

.new-total-teams-box{
    background:linear-gradient(135deg,#ff512f,#dd2476) !important;
}

#totalTeams{
    font-size:3rem !important;
    font-weight:800 !important;
}

.dynamic-table{
    border-radius:12px !important;
    overflow:hidden;
}

.dynamic-table thead{
    background:linear-gradient(135deg,#ff512f,#f09819) !important;
}

.dynamic-table tbody tr:hover{
    background:#dbeafe !important;
    transform:scale(1.02);
}

#create-teams-btn{
    background:linear-gradient(135deg,#00c853,#00e676) !important;
    font-size:18px !important;
    font-weight:700 !important;
    padding:14px !important;
}

#create-teams-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 25px rgba(0,200,83,.4);
}

.team-card{
    background:linear-gradient(135deg,#0f172a,#1e293b) !important;
    border:1px solid rgba(255,255,255,.1);
}

.player-circle{
    box-shadow:0 0 10px rgba(255,255,255,.25);
}

.result-display{
    background:linear-gradient(135deg,#00c6ff,#0072ff) !important;
}

.refresh-btn,
.export-btn,
.clear-btn{
    border-radius:10px !important;
}

.status-working{
    box-shadow:0 0 15px rgba(39,174,96,.9) !important;
}
.left-panel{
    display:flex;
    flex-direction:column;
}

.lineup-section{
    display:flex;
    align-items:flex-start;
    height:auto !important;
    min-height:auto !important;
}

.batting-order{
    height:auto !important;
}

.table-container{
    height:auto !important;
    overflow:visible !important;
}

.dynamic-table{
    height:auto !important;
}

.new-total-teams-box{
    padding:5px 10px !important;
    min-height:70px !important;
    height:auto !important;
    margin-top:8px !important;
}

.total-box{
    padding:5px !important;
}

.total-box h2{
    font-size:12px !important;
    margin-bottom:2px !important;
}

#totalTeams{
    font-size:40px !important;
    line-height:1 !important;
    margin:0 !important;
}
.panel-header{
    display:flex;
    align-items:center;
    width:100%;
}

.panel-header h1{
    margin:0;
}

.header-controls{
    margin-left:auto;
    display:flex;
    align-items:center;
    gap:8px;
}

.platform-select{
    background:#27ae60 !important; /* Export button jaisa green */
    color:white !important;
    border:none !important;
    border-radius:6px !important;
    height:32px !important;
    width:110px !important;
    font-size:12px;
    font-weight:600;
    padding:0 10px;
    margin-right:8px;
}

.refresh-btn{
    width:32px !important;
    height:32px !important;
}
.panel-header{
    border-bottom:none !important;
}
.exclude-box{
    width:100%;
    min-height:50px;
    background:#fff;
    border:2px solid #3498db;
    border-radius:8px;
    padding:8px;
    margin:10px 0 15px 0;
    box-sizing:border-box;
}

.excluded-tags{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-bottom:6px;
}

.player-tag{
    background:#e74c3c;
    color:#fff;
    padding:4px 10px;
    border-radius:20px;
    font-size:12px;
    font-weight:600;
}

.player-tag span{
    margin-left:6px;
    cursor:pointer;
    font-weight:bold;
}

#excluded-player-input{
    width:100%;
    border:none;
    outline:none;
    font-size:14px;
    padding:4px;
}