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

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: linear-gradient(135deg, #37003c 0%, #00ff87 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: end;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group select,
.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group select:focus,
.input-group input:focus {
    outline: none;
    border-color: #37003c;
    box-shadow: 0 0 0 3px rgba(55, 0, 60, 0.1);
}

button {
    background: linear-gradient(135deg, #37003c 0%, #00ff87 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: fit-content;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(0);
}

.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #37003c;
    border-right: 4px solid #00ff87;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fee;
    color: #c33;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #fcc;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.results {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.results h2 {
    background: linear-gradient(135deg, #37003c 0%, #00ff87 100%);
    color: white;
    padding: 20px 30px;
    margin: 0;
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.data-card {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.data-card:last-child {
    border-bottom: none;
}

.data-card h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.data-card h4 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.data-item:last-child {
    border-bottom: none;
}

.label {
    font-weight: 600;
    color: #666;
}

.value {
    font-weight: 700;
    color: #333;
}

.history-table,
.standings-table,
.leagues-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.history-table th,
.standings-table th,
.leagues-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

.history-table td,
.standings-table td,
.leagues-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.history-table tbody tr:nth-child(even),
.standings-table tbody tr:nth-child(even),
.leagues-table tbody tr:nth-child(even) {
    background: rgba(55, 0, 60, 0.02);
}

.history-table tr:hover,
.standings-table tr:hover,
.leagues-table tr:hover {
    background: rgba(0, 255, 135, 0.1);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.league-link {
    color: #37003c;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.league-link:hover {
    color: #00ff87;
    text-decoration: underline;
}

.team-link {
    color: #37003c;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.team-link:hover {
    color: #00ff87;
    text-decoration: underline;
}

.chips-cell {
    white-space: nowrap;
    padding: 8px !important;
}

.chip {
    display: inline-block;
    padding: 4px 6px;
    margin: 1px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
    min-width: 24px;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.chip-available {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: 1px solid #1e7e34;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.chip-used {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border: 1px solid #721c24;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.position-cell {
    white-space: nowrap;
}

.position-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rank {
    font-weight: bold;
    min-width: 20px;
}

.movement {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.movement-up {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: 1px solid #1e7e34;
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.4);
}

.movement-down {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: 1px solid #721c24;
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.4);
}

.movement:hover {
    transform: scale(1.05);
}

.gw-points {
    font-weight: bold;
    color: #37003c;
}

.total-points {
    font-weight: bold;
    color: #228B22;
}

.captain-cell {
    font-weight: 600;
    color: #37003c;
}

.captain-percent {
    font-weight: 600;
    color: #228B22;
    font-size: 0.9rem;
}

.transfers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.transfers-table th,
.transfers-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
}

.transfers-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

.transfers-table tbody tr:nth-child(even) {
    background: rgba(55, 0, 60, 0.02);
}

.transfers-table tr:hover {
    background: rgba(0, 255, 135, 0.1);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.transfer-out {
    color: #dc3545;
    font-weight: 600;
}

.transfer-in {
    color: #228B22;
    font-weight: 600;
}

.transfer-success-indicator {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.transfer-success {
    color: #228B22;
    font-size: 1.2rem;
    font-weight: bold;
}

.transfer-poor {
    color: #dc3545;
    font-size: 1.2rem;
    font-weight: bold;
}

.transfer-neutral {
    color: #ffc107;
    font-size: 1.2rem;
    font-weight: bold;
}

.transfer-legend {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    text-align: center;
}

.transfer-legend small {
    color: #666;
    font-size: 0.85rem;
}

.security-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #37003c 0%, #00ff87 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.security-modal {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.security-modal h2 {
    color: #37003c;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.security-modal p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.security-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.security-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    letter-spacing: 2px;
    font-family: monospace;
    transition: border-color 0.3s ease;
}

.security-input-group input:focus {
    outline: none;
    border-color: #37003c;
    box-shadow: 0 0 0 3px rgba(55, 0, 60, 0.1);
}

.security-input-group button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #37003c 0%, #00ff87 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.security-input-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.security-error {
    color: #dc3545;
    background: #fee;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #fcc;
    font-size: 0.9rem;
    margin-top: 10px;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .search-section {
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group {
        min-width: auto;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .data-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .history-table,
    .standings-table,
    .leagues-table,
    .transfers-table {
        font-size: 0.9rem;
    }
    
    .history-table th,
    .history-table td,
    .standings-table th,
    .standings-table td,
    .leagues-table th,
    .leagues-table td,
    .transfers-table th,
    .transfers-table td {
        padding: 8px;
    }
    
    .chip {
        font-size: 0.7rem;
        padding: 3px 4px;
        margin: 1px;
    }
    
    .chips-cell {
        padding: 4px !important;
    }
    
    .position-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .movement {
        font-size: 0.65rem;
        padding: 1px 3px;
    }
    
    .security-modal {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .security-input-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .security-input-group input {
        font-size: 1.2rem;
        padding: 15px;
    }
}