/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo-container {
    margin-bottom: 20px;
}

.logo {
    height: 80px;
    width: auto;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

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

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Debt Summary Section */
.debt-summary {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    border: 2px solid #d4af37;
}

.debt-summary h2 {
    color: #000;
    margin-bottom: 25px;
    font-size: 2rem;
    border-bottom: 3px solid #d4af37;
    padding-bottom: 10px;
}

.kitty-total {
    background: linear-gradient(135deg, #d4af37 0%, #f4e4bc 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid #000;
}

.total-label {
    font-size: 1.1rem;
    color: #000;
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
}

.total-amount {
    font-size: 3rem;
    font-weight: 700;
    color: #000;
    display: block;
    margin-bottom: 10px;
}

.total-emoji {
    font-size: 2rem;
}

/* Debt Cards */
.debt-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.debt-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.debt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.debt-card.positive {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.debt-card.negative {
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.profile-picture {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #d4af37;
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.debt-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #000;
}

.debt-amount {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #000;
}

.debt-status {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

/* Action Section */
.action-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 2px solid #d4af37;
}

.action-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #000;
    font-size: 1.8rem;
    border-bottom: 3px solid #d4af37;
    padding-bottom: 10px;
}

.form-instructions {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 1rem;
}

/* Apex Legends Scoring Section */
.apex-score-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.apex-score-section h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.apex-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.score-input-group {
    display: flex;
    flex-direction: column;
}

.score-input-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.score-input-group input {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.score-input-group input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

.tier-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.tier-info h4 {
    color: #333;
    margin-bottom: 10px;
}

.tier-info ul {
    list-style: none;
    padding: 0;
    margin-bottom: 10px;
}

.tier-info li {
    padding: 5px 0;
    color: #666;
}

.tier-info p {
    margin: 0;
    font-weight: 600;
    color: #333;
}

/* Fix form alignment - ensure all form groups have consistent height */
.game-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    align-items: end; /* Align items to the bottom (dropdowns level) */
}

.form-group {
    display: flex;
    flex-direction: column;
    min-height: 80px; /* Ensure consistent height */
}

.form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: block; /* Ensure label is always above the input */
}

.form-group select,
.form-group input {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    width: 100%; /* Ensure full width */
    box-sizing: border-box; /* Include padding in width calculation */
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* Black and Gold Button Styling */
.btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #f4e4bc 100%);
    color: #000;
    border: 2px solid #000;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #f4e4bc 0%, #d4af37 100%);
}

/* Black and Gold Secondary Button */
.btn-secondary {
    background: #000;
    color: #d4af37;
    border: 2px solid #d4af37;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-secondary:hover {
    background: #d4af37;
    color: #000;
    transform: translateY(-1px);
}

/* Improved Fines Reference Styling */
.fines-reference {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 2px solid #d4af37;
}

.fines-reference h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #000;
    font-size: 1.8rem;
    border-bottom: 3px solid #d4af37;
    padding-bottom: 10px;
}

.fines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.game-fines {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #e9ecef;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.game-fines:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #d4af37;
}

.game-fines h3 {
    color: #000;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 8px;
}

.fine-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

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

.fine-item:hover {
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    padding: 12px 8px;
}

.fine-type {
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 80px;
    text-align: center;
}

.fine-type.credit {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

.fine-type.debt-buster {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.fine-type.apex-scoring {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.fine-action {
    flex: 1;
    margin: 0 15px;
    color: #333;
    font-weight: 500;
}

.fine-amount {
    font-weight: 600;
    color: #000;
    background: #d4af37;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #000;
    min-width: 80px;
    text-align: center;
}

/* History Section Styling */
.history-section {
    background: white !important;
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 2px solid #d4af37;
}

.history-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #000;
    font-size: 1.8rem;
    border-bottom: 3px solid #d4af37;
    padding-bottom: 10px;
}

.history-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    background: #f8f9fa;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #ffd700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

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

.history-details {
    flex: 1;
}

.history-player {
    font-weight: 600;
    color: #000;
    margin-bottom: 5px;
}

.history-result {
    color: #666;
    font-size: 0.9rem;
}

.history-amount {
    font-weight: 600;
    margin-left: 20px;
    color: #000;
    background: #d4af37;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #000;
}

.history-amount.credit {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.history-amount.fine {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.history-amount.debt-buster {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.history-amount.manual {
    background: #e2e3e5;
    color: #383d41;
    border-color: #d6d8db;
}

.history-amount.apex-scoring {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.no-history {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Manual Debt Section */
.manual-debt-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 2px solid #d4af37;
}

.manual-debt-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #000;
    font-size: 1.8rem;
    border-bottom: 3px solid #d4af37;
    padding-bottom: 10px;
}

.manual-debt-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    align-items: start;
}

.manual-debt-form .btn-primary {
    margin-top: 10px;
}

/* Apex Confirmation Popup Styling */
.apex-scores-display {
    margin-bottom: 20px;
}

.apex-scores-display h4 {
    color: #000;
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 5px;
}

.score-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    color: #555;
}

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

.debt-breakdown {
    margin-bottom: 20px;
}

.debt-breakdown h4 {
    color: #000;
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 5px;
}

.debt-breakdown-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    color: #dc3545;
    font-weight: 500;
}

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

.total-debt-added {
    padding: 12px 0;
    margin-top: 10px;
    border-top: 2px solid #ffd700;
    color: #000;
    font-weight: 600;
    font-size: 1.1rem;
}

.kitty-update {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #d4af37;
}

.kitty-update h4 {
    color: #000;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.kitty-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4af37;
    background: #000;
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
}

/* Confirmation Popup Styles */
.confirmation-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 3px solid #d4af37;
}

.popup-header {
    background: linear-gradient(135deg, #000 0%, #333 100%);
    color: #d4af37;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.popup-close {
    background: none;
    border: none;
    color: #d4af37;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.popup-close:hover {
    background: rgba(212, 175, 55, 0.2);
}

.popup-body {
    padding: 25px;
}

.popup-footer {
    padding: 20px;
    text-align: center;
    border-top: 2px solid #ffd700;
}