/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    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;
}

/* Tabs */
.tabs {
    display: flex;
    background: white;
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
}

.tab-button:hover {
    background: #f0f0f0;
    color: #333;
}

.tab-button.active {
    background: #2a5298;
    color: white;
    box-shadow: 0 2px 10px rgba(42, 82, 152, 0.3);
}

.tab-button i {
    margin-right: 8px;
}

/* Tab content */
.tab-content {
    display: none;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-right: 20px;
    opacity: 0.8;
}

.stat-info h3 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.stat-info p {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Recent activity */
.recent-activity {
    margin-top: 30px;
}

.recent-activity h2 {
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
}

.recent-activity h2 i {
    margin-right: 10px;
    color: #2a5298;
}

.activity-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.activity-item:last-child {
    margin-bottom: 0;
}

.activity-player {
    font-weight: 600;
    color: #2a5298;
}

.activity-value {
    font-weight: 600;
    color: #28a745;
}

/* Section headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h2 {
    color: #333;
    display: flex;
    align-items: center;
}

.section-header h2 i {
    margin-right: 10px;
    color: #2a5298;
}

/* Add player form */
.add-player-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-player-form input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

.add-player-form input:focus {
    outline: none;
    border-color: #2a5298;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: #2a5298;
    color: white;
}

.btn-primary:hover {
    background: #1e3c72;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(42, 82, 152, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* Players grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.player-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    border-left: 5px solid #2a5298;
}

.player-card:hover {
    transform: translateY(-5px);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2a5298;
}

.player-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.player-stat {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.player-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #28a745;
    margin-bottom: 5px;
}

.player-stat-label {
    font-size: 0.9rem;
    color: #666;
}

.player-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Split calculator */
.split-summary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.split-summary h2 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.split-summary h2 i {
    margin-right: 10px;
}

.split-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.split-stat {
    text-align: center;
}

.split-stat .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.split-stat .value {
    font-size: 1.5rem;
    font-weight: 600;
}

.split-results {
    display: grid;
    gap: 15px;
}

.split-player {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.split-player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.split-player-name {
    font-weight: 600;
    color: #2a5298;
    font-size: 1.1rem;
}

.split-player-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
}

.split-player-amount {
    font-size: 1.2rem;
    font-weight: 600;
}

.amount-positive {
    color: #28a745;
}

.amount-negative {
    color: #dc3545;
}

.amount-neutral {
    color: #6c757d;
}

/* Webhook setup */
.webhook-setup {
    max-width: 800px;
}

.webhook-setup h2 {
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
}

.webhook-setup h2 i {
    margin-right: 10px;
    color: #2a5298;
}

.webhook-setup p {
    margin-bottom: 30px;
    color: #666;
    font-size: 1.1rem;
}

.webhook-url {
    margin-bottom: 30px;
}

.webhook-url label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.url-input-group {
    display: flex;
    gap: 10px;
}

.url-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: #f8f9fa;
}

.webhook-format {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.webhook-format h3 {
    margin-bottom: 15px;
    color: #333;
}

.webhook-format pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.test-webhook {
    text-align: center;
}

.test-webhook h3 {
    margin-bottom: 15px;
    color: #333;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-player-form {
        flex-direction: column;
    }
    
    .add-player-form input {
        min-width: auto;
        width: 100%;
    }
    
    .players-grid {
        grid-template-columns: 1fr;
    }
    
    .player-stats {
        grid-template-columns: 1fr;
    }
    
    .split-stats {
        grid-template-columns: 1fr;
    }
    
    .split-player {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .split-player-info {
        justify-content: center;
    }
    
    .url-input-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .tab-content {
        padding: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        font-size: 2rem;
        margin-right: 15px;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2a5298;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success/Error messages */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Payload Dashboard Styles */
.payload-dashboard {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.payload-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.payload-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

.payload-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.payload-stat-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid #2a5298;
}

.payload-stat-card .stat-icon {
    font-size: 2rem;
    color: #2a5298;
}

.payload-stat-card .stat-info h3 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: #333;
}

.payload-stat-card .stat-info p {
    color: #666;
    font-size: 0.9rem;
}

.payload-list {
    margin-top: 30px;
}

.payloads-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
}

.payload-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #ddd;
}

.payload-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.payload-item.payload-success {
    border-left-color: #28a745;
}

.payload-item.payload-error {
    border-left-color: #dc3545;
}

.payload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.payload-info {
    flex: 1;
}

.payload-endpoint {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.payload-time {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

.payload-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.payload-status .fa-check-circle {
    color: #28a745;
}

.payload-status .fa-exclamation-circle {
    color: #dc3545;
}

.payload-preview {
    background: white;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #e0e0e0;
}

.payload-preview pre {
    margin: 0;
    font-size: 0.85rem;
    color: #333;
    white-space: pre-wrap;
    word-break: break-all;
}

.payload-error-message {
    margin-top: 15px;
    padding: 10px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.no-payloads {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-payloads h3 {
    margin-bottom: 10px;
    color: #333;
}

/* Payload Modal Styles */
.payload-modal {
    max-width: 900px;
    width: 95%;
}

.payload-details {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.payload-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.meta-item label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.meta-item span {
    color: #333;
    font-size: 1rem;
}

.status-success {
    color: #28a745;
    font-weight: 600;
}

.status-error {
    color: #dc3545;
    font-weight: 600;
}

.payload-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.payload-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.payload-section h4 {
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.json-viewer {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Mobile Responsiveness for Payload Dashboard */
@media (max-width: 768px) {
    .payload-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .payload-controls select {
        width: 100%;
    }
    
    .payload-stats {
        grid-template-columns: 1fr;
    }
    
    .payload-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .payload-meta {
        grid-template-columns: 1fr;
    }
    
    .payload-modal {
        width: 98%;
        margin: 10px;
    }
    
    .json-viewer {
        font-size: 0.8rem;
        padding: 15px;
    }
}

