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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 10px;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 24px;
}

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

.header-balance {
    padding: 4px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card h2 {
    margin-bottom: 15px;
    color: #1a1a2e;
    font-size: 20px;
}

.card h3 {
    margin: 15px 0 10px;
    color: #444;
    font-size: 16px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #4a90d9;
    color: #fff;
}

.btn-primary:hover {
    background: #357abd;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

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

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

tr:hover {
    background: #f8f9fa;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.balances {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

.balance-item .currency {
    font-weight: 700;
    color: #4a90d9;
    font-size: 16px;
}

.balance-item .amount {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
}

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

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

.status-pending {
    color: #f39c12;
    font-weight: 600;
}

.status-won {
    color: #27ae60;
    font-weight: 600;
}

.status-lost {
    color: #e74c3c;
    font-weight: 600;
}

.auth-form {
    max-width: 400px;
    margin: 80px auto;
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.auth-form h1 {
    text-align: center;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.auth-form h2 {
    text-align: center;
    color: #666;
    font-weight: 400;
    margin-bottom: 30px;
}

.form-actions {
    margin-top: 20px;
}

.form-actions .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.form-footer {
    text-align: center;
    margin-top: 15px;
}

.form-footer a {
    color: #4a90d9;
    text-decoration: none;
}

.login-credentials {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.btn-credentials-toggle {
    background: none;
    border: 1px solid #ddd;
    color: #999;
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-credentials-toggle:hover {
    color: #666;
    border-color: #bbb;
    background: #f5f5f5;
}

.login-credentials table {
    font-size: 12px;
    margin-top: 12px;
}

.login-credentials th {
    background: transparent;
    color: #999;
    font-weight: 500;
    padding: 4px 8px;
    border-bottom: 1px solid #eee;
}

.login-credentials td {
    padding: 4px 8px;
    color: #777;
    font-family: monospace;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: #bbb;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.login-footer a:hover {
    color: #4a90d9;
}

.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #f5f5f5;
}

.tab-btn.active {
    background: #1a1a2e;
    color: #fff;
}

.tab-content {
    display: none;
}

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

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

.error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 3px;
    display: block;
}

.contacts-list {
    margin-bottom: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid #e8e8e8;
}

.contact-item .contact-type {
    font-weight: 600;
    color: #4a90d9;
    font-size: 12px;
    text-transform: uppercase;
    min-width: 50px;
}

.contact-item .contact-value {
    flex: 1;
    font-size: 14px;
}

.contact-item .btn {
    flex-shrink: 0;
}

.add-contact-form {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.add-contact-form select,
.add-contact-form input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.add-contact-form select {
    min-width: 90px;
}

.add-contact-form input {
    flex: 1;
    min-width: 120px;
}

.events-table {
    font-size: 13px;
}

.events-table th:first-child {
    text-align: left;
}

.events-table th, .events-table td {
    text-align: center;
}

.events-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.chosen-outcome {
    font-weight: 700;
    color: #27ae60;
    background: #e8f8ef;
}

.outcome-btn {
    background: #f0f2f5;
    border: 2px solid #ddd;
    color: #333;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.outcome-btn:hover {
    border-color: #4a90d9;
    background: #e8f0fe;
}

.outcome-btn.active {
    border-color: #4a90d9;
    background: #4a90d9;
    color: #fff;
}

@media (max-width: 900px) {
    .admin-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .admin-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: none;
        padding: 12px 14px;
        font-size: 13px;
    }

    .tab-btn:last-child {
        padding-right: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        text-align: center;
        margin-bottom: 16px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .card {
        padding: 14px;
    }

    .card h2 {
        font-size: 17px;
    }

    .table-wrap {
        margin: 0 -14px;
        padding: 0 14px;
    }

    th, td {
        padding: 8px 6px;
        font-size: 12px;
        white-space: nowrap;
    }

    .actions {
        flex-direction: column;
        gap: 4px;
    }

    .actions .btn,
    td .btn {
        width: 100%;
        text-align: center;
    }

    td .btn {
        margin-bottom: 4px;
    }

    td .btn:last-child {
        margin-bottom: 0;
    }

    #usersContainer tr:not(.detail-row) th:nth-child(1),
    #usersContainer tr:not(.detail-row) td:nth-child(1) {
        display: none;
    }

    #eventsContainer th:nth-child(1),
    #eventsContainer td:nth-child(1),
    #eventsContainer th:nth-child(7),
    #eventsContainer td:nth-child(7) {
        display: none;
    }

    #allBetsContainer th:nth-child(1),
    #allBetsContainer td:nth-child(1) {
        display: none;
    }

    #pendingBetsContainer th:nth-child(1),
    #pendingBetsContainer td:nth-child(1) {
        display: none;
    }

    .add-contact-form {
        flex-direction: column;
    }

    .add-contact-form select,
    .add-contact-form input {
        width: 100%;
        min-width: 0;
    }

    .contact-item {
        flex-wrap: wrap;
    }

    .auth-form {
        margin: 40px auto;
        padding: 24px 20px;
    }

    .auth-form h2 {
        margin-bottom: 20px;
    }

    .btn-sm {
        padding: 8px 14px;
        font-size: 13px;
    }

    .outcome-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .balance-item {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
    }

    .events-table td:first-child {
        white-space: normal;
        min-width: 120px;
    }

    .detail-row td {
        padding: 12px;
    }

    .detail-row td > div {
        flex-direction: column;
        gap: 8px;
    }

    .detail-row td > div > .form-group {
        width: 100%;
    }

    .detail-row td > div[style*="flex"] {
        flex-direction: column;
        gap: 8px;
    }

    .detail-row td > div[style*="flex"] > .form-group {
        flex: none;
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 600px) {
    #logsContainer th:nth-child(1),
    #logsContainer td:nth-child(1),
    #logsContainer th:nth-child(6),
    #logsContainer td:nth-child(6),
    #logsContainer th:nth-child(7),
    #logsContainer td:nth-child(7),
    #logsContainer th:nth-child(8),
    #logsContainer td:nth-child(8) {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header {
        padding: 12px;
        border-radius: 8px;
    }

    .header h1 {
        font-size: 17px;
    }

    .header-info {
        gap: 8px;
    }

    .header-balance {
        font-size: 12px;
        padding: 3px 10px;
    }

    .card {
        padding: 12px;
        border-radius: 8px;
    }

    .card h2 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .tab-btn {
        padding: 10px 10px;
        font-size: 12px;
    }

    th, td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .auth-form {
        margin: 20px auto;
        padding: 20px 16px;
    }

    .auth-form h2 {
        font-size: 16px;
    }

    .form-group input,
    .form-group select {
        padding: 12px 10px;
        font-size: 16px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }

    .btn-sm {
        padding: 10px 12px;
        font-size: 13px;
    }

    .balances {
        flex-direction: column;
    }

    .balance-item {
        flex: none;
        width: 100%;
    }

    .events-table td:first-child {
        min-width: 100px;
        font-size: 12px;
    }

    .outcome-btn {
        padding: 12px 10px;
        font-size: 12px;
        min-width: calc(33% - 4px);
    }

    #addEventForm > div[style*="flex"],
    .detail-row td > div[style*="flex"] {
        flex-direction: column;
        gap: 8px;
    }

    #addEventForm > div[style*="flex"] .form-group,
    .detail-row td > div[style*="flex"] .form-group {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    #allBetsContainer th:nth-child(8),
    #allBetsContainer td:nth-child(8),
    #pendingBetsContainer th:nth-child(7),
    #pendingBetsContainer td:nth-child(7) {
        display: none;
    }

    #usersContainer tr:not(.detail-row) th:nth-child(4),
    #usersContainer tr:not(.detail-row) td:nth-child(4) {
        display: none;
    }
}
