/* Variables */
:root {
    --color-primary: #ffcb05;
    --color-secondary: #3d7dca;
    --color-dark: #1d1d1d;
    --color-light: #f5f5f5;
    --color-white: #ffffff;
    --color-error: #e74c3c;
    --color-success: #27ae60;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--color-secondary) 0%, #2c5aa0 100%);
    min-height: 100vh;
    color: var(--color-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0 20px;
}

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

header .subtitle {
    color: var(--color-white);
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Search Section */
.search-section {
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.search-box input {
    flex: 1;
    padding: 14px 18px;
    border: none;
    font-size: 1rem;
    outline: none;
}

.search-box input::placeholder {
    color: #999;
}

.search-box button {
    padding: 14px 20px;
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-box button:hover {
    background: #e6b800;
}

.search-box button svg {
    color: var(--color-dark);
}

.or-divider {
    text-align: center;
    color: var(--color-white);
    margin-top: 20px;
    font-size: 0.95rem;
    opacity: 0.8;
}

/* Capture Section */
.capture-section {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Capture Buttons */
.capture-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.capture-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 40px;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}

.capture-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.capture-btn svg {
    color: var(--color-secondary);
}

.capture-btn span {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-dark);
}

.camera-btn:hover svg {
    color: var(--color-primary);
}

.upload-btn:hover svg {
    color: var(--color-success);
}

/* Image Preview */
.image-preview {
    position: relative;
    max-width: 350px;
    width: 100%;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.clear-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: var(--color-white);
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:hover {
    background: var(--color-error);
}

/* Analyze Button */
.analyze-btn {
    padding: 16px 50px;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--color-primary);
    color: var(--color-dark);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.analyze-btn:hover {
    background: #e6b800;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Processing */
.processing {
    text-align: center;
    padding: 40px;
    color: var(--color-white);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

/* Detected Card */
.detected-card {
    text-align: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    color: var(--color-white);
    max-width: 600px;
    margin: 0 auto 20px;
}

.detected-card strong {
    color: var(--color-primary);
}

/* Error */
.error {
    text-align: center;
    padding: 20px;
    background: var(--color-error);
    color: var(--color-white);
    border-radius: var(--radius);
    max-width: 600px;
    margin: 0 auto 20px;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Results */
.results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    flex: 1;
}

/* Card */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: contain;
    background: var(--color-light);
    padding: 15px;
}

.card-info {
    padding: 15px;
}

.card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-dark);
    margin-bottom: 8px;
}

.card-set {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 4px;
}

.card-rarity {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

.card-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-secondary);
}

.card-price.no-price {
    font-size: 0.95rem;
    color: #999;
    font-weight: normal;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--color-white);
    opacity: 0.8;
    font-size: 0.9rem;
}

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

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

/* No results message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--color-white);
    font-size: 1.1rem;
}

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

    header .subtitle {
        font-size: 1rem;
    }

    .api-key-section {
        padding: 0 15px;
    }

    .capture-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 20px;
    }

    .capture-btn {
        width: 100%;
        padding: 25px;
        flex-direction: row;
        justify-content: center;
    }

    .image-preview {
        max-width: 100%;
        margin: 0 20px;
    }

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