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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #114B5F 0%, #749C75 100%);
    min-height: 100vh;
    padding: 20px;
}

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

/* Header */
.header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: #114B5F;
    font-size: 24px;
}

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

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-links a {
    padding: 8px 16px;
    background: #749C75;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: background 0.3s;
}

.nav-links a:hover {
    background: #5f8160;
}

.nav-links a.active {
    background: #114B5F;
}

.logout-btn {
    background: #BE6E46;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.logout-btn:hover {
    background: #a85f3a;
}

/* Card */
.card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    border-bottom: 2px solid #749C75;
    padding-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
    position: relative;
}

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

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #749C75;
}

button,
.btn {
    background: #749C75;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
}

button:hover,
.btn:hover {
    background: #5f8160;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

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

.btn-danger {
    background: #BE6E46;
}

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

/* Messages */
.error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 50px auto;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: #f0f0f0;
    cursor: pointer;
    border: 1px solid #ddd;
}

.tab.active {
    background: white;
    border-bottom: none;
}

.tab-content {
    display: none;
}

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

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: #FDF0D5;
}

th.sortable::after {
    content: ' ⇅';
    opacity: 0.3;
}

th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

tr:hover {
    background: #FDF0D5;
}

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

.stat-box {
    background: #FDF0D5;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

.stat-box h3 {
    color: #114B5F;
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-box p {
    color: #666;
    font-size: 14px;
}

/* Player rows */
.player-row {
    background: #FDF0D5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.player-row input {
    margin-bottom: 5px;
}

input[type="radio"] {
    margin-right: 5px;
}

input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

/* Autocomplete */
.autocomplete-container {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-results.active {
    display: block;
}

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

.autocomplete-item:hover {
    background: #FDF0D5;
}

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

.color-identity {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

.loading {
    padding: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Mana symbols */
.mana-symbols {
    display: inline-flex;
    gap: 2px;
}

.mana-symbol {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.mana-W {
    background: #f0e68c;
    border: 1px solid #daa520;
}

.mana-U {
    background: #add8e6;
    border: 1px solid #4682b4;
}

.mana-B {
    background: #2f2f2f;
    border: 1px solid #000;
}

.mana-R {
    background: #ff6347;
    border: 1px solid #dc143c;
}

.mana-G {
    background: #90ee90;
    border: 1px solid #228b22;
}

/* Partner commanders */
.commander-inputs {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.commander-input-group {
    flex: 1;
}

.partner-commanders {
    border: 2px dashed #749C75;
    padding: 15px;
    border-radius: 5px;
    background: #f8f9fa;
}

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

.partner-header h4 {
    color: #114B5F;
    margin: 0;
}

.combined-colors {
    background: #96C5F7;
    padding: 8px 12px;
    border-radius: 5px;
    margin-top: 10px;
    text-align: center;
    font-weight: 600;
    color: #114B5F;
}

/* Quick stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.quick-stat-item {
    background: linear-gradient(135deg, #114B5F 0%, #749C75 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.quick-stat-item h4 {
    font-size: 28px;
    margin-bottom: 5px;
}

.quick-stat-item p {
    font-size: 12px;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .commander-inputs {
        flex-direction: column;
    }

    .header {
        flex-direction: column;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }
}