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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --accent: #e94560;
    --accent-hover: #c93a52;
    --text-primary: #eee;
    --text-secondary: #aaa;
    --border: #2a2a4e;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Header */
header {
    background: var(--bg-secondary);
    padding: 2rem 0;
    box-shadow: 0 4px 6px var(--shadow);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #ffcb05, #3d7dca);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

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

.search-bar input {
    flex: 1;
    min-width: 250px;
    padding: 12px 20px;
    font-size: 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
}

button {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

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

button.secondary {
    background: var(--bg-card);
    border: 2px solid var(--border);
}

button.secondary:hover {
    background: var(--border);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 12px 24px;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--text-primary);
    transform: none;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

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

/* Loading and Error */
.loading, .error {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    background: rgba(233, 69, 96, 0.1);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
}

.hidden {
    display: none !important;
}

/* Sets Grid */
.sets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 1.5rem;
}

.set-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.set-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 8px 16px var(--shadow);
}

.set-logo {
    width: 100%;
    max-width: 200px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.set-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.set-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 1.5rem;
}

.card-item {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.card-item:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 12px 24px var(--shadow);
}

.card-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.card-item h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.card-item p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* Card Detail */
.card-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.card-detail-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 16px var(--shadow);
}

.card-detail-info h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.card-detail-info .info-group {
    margin-bottom: 1.5rem;
}

.card-detail-info .info-group h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-detail-info .info-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.card-detail-info .info-item:last-child {
    border-bottom: none;
}

.card-detail-info .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.card-detail-info .value {
    color: var(--text-primary);
    font-weight: 600;
}

.attack-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.attack-item h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.attack-cost {
    display: flex;
    gap: 5px;
    margin-bottom: 0.5rem;
}

.energy-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-block;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .card-detail {
        grid-template-columns: 1fr;
    }

    .sets-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .card-item {
        padding: 0.5rem;
    }
}
