/*
 * Valor's Call - Digital Binder Styles
 * Color Palette:
 * - #91c1dc (Light Blue - Sky)
 * - #ffd166 (Gold - Accent/Legendary)
 * - #06d6a0 (Emerald - Success/Uncommon)
 * - #118ab2 (Ocean Blue - Primary)
 * - #073b4c (Dark Teal - Dark BG/Text)
 * - #c0c0c0 (Silver - Common)
 * - #f7e8c0 (Parchment - Light BG)
 */

:root {
    --color-sky: #91c1dc;
    --color-gold: #ffd166;
    --color-emerald: #06d6a0;
    --color-ocean: #118ab2;
    --color-dark: #073b4c;
    --color-silver: #c0c0c0;
    --color-parchment: #f7e8c0;

    /* Rarity colors */
    --rarity-common: #c0c0c0;
    --rarity-uncommon: #06d6a0;
    --rarity-rare: #118ab2;
    --rarity-epic: #9b59b6;
    --rarity-legendary: #ffd166;

    /* Layout */
    --nav-height: 60px;
    --card-width: 200px;
    --card-height: 280px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-dark) 0%, #0a4a5e 100%);
    color: var(--color-parchment);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.main-nav {
    background: rgba(7, 59, 76, 0.95);
    backdrop-filter: blur(10px);
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 2px solid var(--color-ocean);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-gold);
    text-decoration: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    margin-left: 3rem;
}

.nav-links a {
    color: var(--color-parchment);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: var(--color-ocean);
    color: white;
}

.nav-links a.active {
    background: var(--color-ocean);
    color: white;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    font-weight: bold;
    color: var(--color-sky);
}

.dust-display {
    color: var(--color-gold);
    font-weight: bold;
}

.packs-display {
    color: var(--color-emerald);
    font-weight: bold;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--color-parchment);
    color: var(--color-parchment);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--color-parchment);
    color: var(--color-dark);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.main-footer {
    background: rgba(7, 59, 76, 0.95);
    text-align: center;
    padding: 1rem;
    border-top: 2px solid var(--color-ocean);
    color: var(--color-silver);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-width), 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.card-item {
    background: rgba(247, 232, 192, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
}

.card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.card-item.not-owned {
    opacity: 0.4;
    filter: grayscale(80%);
}

.card-item.not-owned:hover {
    opacity: 0.6;
    filter: grayscale(50%);
}

.card-image {
    width: 100%;
    aspect-ratio: 5/7;
    object-fit: cover;
    display: block;
}

.card-info {
    padding: 0.75rem;
    background: rgba(7, 59, 76, 0.8);
}

.card-name {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-number {
    font-size: 0.75rem;
    color: var(--color-silver);
}

.card-rarity {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* Rarity colors */
.rarity-common {
    background: var(--rarity-common);
    color: #333;
}

.rarity-uncommon {
    background: var(--rarity-uncommon);
    color: #fff;
}

.rarity-rare {
    background: var(--rarity-rare);
    color: #fff;
}

.rarity-epic {
    background: var(--rarity-epic);
    color: #fff;
}

.rarity-legendary {
    background: var(--rarity-legendary);
    color: #333;
    animation: legendary-glow 2s ease-in-out infinite;
}

@keyframes legendary-glow {
    0%, 100% { box-shadow: 0 0 5px var(--rarity-legendary); }
    50% { box-shadow: 0 0 20px var(--rarity-legendary), 0 0 30px var(--rarity-legendary); }
}

/* Rarity border glow on cards */
.card-item.rarity-border-legendary {
    box-shadow: 0 0 15px var(--rarity-legendary);
}

.card-item.rarity-border-epic {
    box-shadow: 0 0 10px var(--rarity-epic);
}

.card-item.rarity-border-rare {
    box-shadow: 0 0 8px var(--rarity-rare);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: var(--color-ocean);
    color: white;
}

.btn-primary:hover {
    background: #0d7399;
}

.btn-gold {
    background: linear-gradient(135deg, var(--color-gold), #e5b84a);
    color: var(--color-dark);
}

.btn-gold:hover {
    background: linear-gradient(135deg, #e5b84a, var(--color-gold));
    transform: scale(1.02);
}

.btn-success {
    background: var(--color-emerald);
    color: white;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Page Headers */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--color-gold);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--color-sky);
}

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

.stat-card {
    background: rgba(247, 232, 192, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(145, 193, 220, 0.2);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-gold);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--color-sky);
    margin-top: 0.25rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-ocean), var(--color-emerald));
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: rgba(247, 232, 192, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(145, 193, 220, 0.2);
}

.login-container h1 {
    text-align: center;
    color: var(--color-gold);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-sky);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-ocean);
    border-radius: 6px;
    background: rgba(7, 59, 76, 0.8);
    color: var(--color-parchment);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 5px rgba(255, 209, 102, 0.3);
}

.error-message {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    color: #ff6b6b;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.success-message {
    background: rgba(6, 214, 160, 0.2);
    border: 1px solid var(--color-emerald);
    color: var(--color-emerald);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Pack Opening */
.pack-area {
    text-align: center;
    padding: 2rem;
}

.pack-container {
    position: relative;
    width: 250px;
    height: 350px;
    margin: 2rem auto;
    perspective: 1000px;
}

.booster-pack {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-dark), var(--color-ocean));
    border-radius: 12px;
    border: 3px solid var(--color-gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.booster-pack::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 209, 102, 0.1) 50%,
        transparent 70%
    );
    animation: pack-shine 3s ease-in-out infinite;
}

@keyframes pack-shine {
    0%, 100% { transform: translateX(-100%) rotate(45deg); }
    50% { transform: translateX(100%) rotate(45deg); }
}

.booster-pack:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 209, 102, 0.5);
}

.booster-pack h2 {
    color: var(--color-gold);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    z-index: 1;
}

.booster-pack p {
    color: var(--color-parchment);
    z-index: 1;
}

.pack-opening {
    animation: pack-shake 0.5s ease-in-out;
}

@keyframes pack-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.pack-ripping {
    animation: pack-rip 0.8s ease-out forwards;
}

@keyframes pack-rip {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); }
    100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

/* Card Reveal */
.card-reveal-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.card-reveal-container.active {
    display: flex;
}

.revealed-card {
    width: 280px;
    background: rgba(7, 59, 76, 0.9);
    border-radius: 12px;
    overflow: hidden;
    animation: card-reveal 0.5s ease-out;
    border: 3px solid var(--color-silver);
}

.revealed-card.rarity-uncommon {
    border-color: var(--rarity-uncommon);
    box-shadow: 0 0 20px var(--rarity-uncommon);
}

.revealed-card.rarity-rare {
    border-color: var(--rarity-rare);
    box-shadow: 0 0 25px var(--rarity-rare);
}

.revealed-card.rarity-epic {
    border-color: var(--rarity-epic);
    box-shadow: 0 0 30px var(--rarity-epic);
    animation: card-reveal 0.5s ease-out, epic-pulse 1.5s ease-in-out infinite;
}

.revealed-card.rarity-legendary {
    border-color: var(--rarity-legendary);
    box-shadow: 0 0 40px var(--rarity-legendary);
    animation: card-reveal 0.5s ease-out, legendary-pulse 1s ease-in-out infinite;
}

@keyframes card-reveal {
    0% { transform: scale(0) rotateY(180deg); opacity: 0; }
    100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

@keyframes epic-pulse {
    0%, 100% { box-shadow: 0 0 30px var(--rarity-epic); }
    50% { box-shadow: 0 0 50px var(--rarity-epic), 0 0 70px var(--rarity-epic); }
}

@keyframes legendary-pulse {
    0%, 100% { box-shadow: 0 0 40px var(--rarity-legendary); }
    50% { box-shadow: 0 0 60px var(--rarity-legendary), 0 0 80px var(--rarity-legendary), 0 0 100px var(--rarity-legendary); }
}

/* ============================================
   CARD REVEAL EFFECTS - Particles & Screen Shake
   ============================================ */

/* Particle Container */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

/* Individual Particles */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: particle-float 1.5s ease-out forwards;
}

.particle.spark {
    width: 4px;
    height: 4px;
    background: white;
    box-shadow: 0 0 6px 2px currentColor;
}

.particle.dust {
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, currentColor 0%, transparent 70%);
    opacity: 0.8;
}

.particle.star {
    width: 8px;
    height: 8px;
    background: currentColor;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 0 0 10px currentColor;
}

/* Rarity-specific particle colors */
.particle.rarity-rare {
    color: var(--rarity-rare);
}

.particle.rarity-epic {
    color: var(--rarity-epic);
}

.particle.rarity-legendary {
    color: var(--rarity-legendary);
}

@keyframes particle-float {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0) rotate(var(--rot));
        opacity: 0;
    }
}

/* Screen Shake Animations */
@keyframes shake-light {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

@keyframes shake-medium {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-4px, -2px); }
    20%, 40%, 60%, 80% { transform: translate(4px, 2px); }
}

@keyframes shake-heavy {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-6px, -3px) rotate(-0.5deg); }
    20% { transform: translate(6px, 2px) rotate(0.5deg); }
    30% { transform: translate(-5px, -4px) rotate(-0.3deg); }
    40% { transform: translate(5px, 3px) rotate(0.3deg); }
    50% { transform: translate(-4px, -2px) rotate(-0.2deg); }
    60% { transform: translate(4px, 1px) rotate(0.2deg); }
    70% { transform: translate(-3px, -1px) rotate(-0.1deg); }
    80% { transform: translate(3px, 2px) rotate(0.1deg); }
    90% { transform: translate(-2px, -1px) rotate(0deg); }
}

.shake-light {
    animation: shake-light 0.4s ease-out;
}

.shake-medium {
    animation: shake-medium 0.5s ease-out;
}

.shake-heavy {
    animation: shake-heavy 0.7s ease-out;
}

/* Legendary golden glow burst */
@keyframes legendary-burst {
    0% {
        box-shadow: 0 0 40px var(--rarity-legendary), 0 0 80px var(--rarity-legendary), 0 0 120px var(--rarity-legendary);
        filter: brightness(1.5);
    }
    50% {
        box-shadow: 0 0 60px var(--rarity-legendary), 0 0 100px var(--rarity-legendary), 0 0 150px var(--rarity-legendary), 0 0 200px rgba(255, 209, 102, 0.3);
        filter: brightness(1.2);
    }
    100% {
        box-shadow: 0 0 40px var(--rarity-legendary);
        filter: brightness(1);
    }
}

.revealed-card.rarity-legendary.burst {
    animation: legendary-burst 1s ease-out, legendary-pulse 1s ease-in-out 1s infinite;
}

/* Flash overlay for legendary reveals */
.legendary-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 209, 102, 0.6) 0%, transparent 70%);
    pointer-events: none;
    z-index: 998;
    animation: flash-fade 0.8s ease-out forwards;
}

@keyframes flash-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.revealed-card img {
    width: 100%;
    display: block;
}

.revealed-card-info {
    padding: 1rem;
    text-align: center;
}

.revealed-card-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-parchment);
    margin-bottom: 0.5rem;
}

.duplicate-badge {
    background: var(--color-gold);
    color: var(--color-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 0.5rem;
    display: inline-block;
}

.card-counter {
    margin: 1rem 0;
    font-size: 1.2rem;
    color: var(--color-sky);
}

.reveal-controls {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Pack Summary */
.pack-summary {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.pack-summary.active {
    display: block;
}

.pack-summary h2 {
    color: var(--color-gold);
    margin-bottom: 1.5rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: rgba(7, 59, 76, 0.8);
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

.summary-card img {
    width: 100%;
    aspect-ratio: 5/7;
    object-fit: cover;
}

.summary-card-name {
    padding: 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-stats {
    background: rgba(247, 232, 192, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Admin Panel */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(247, 232, 192, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(145, 193, 220, 0.2);
}

.admin-table th {
    background: rgba(7, 59, 76, 0.8);
    color: var(--color-gold);
    font-weight: bold;
}

.admin-table tr:hover {
    background: rgba(145, 193, 220, 0.1);
}

.admin-form {
    background: rgba(247, 232, 192, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.admin-form h3 {
    color: var(--color-gold);
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Filters */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--color-ocean);
    background: rgba(7, 59, 76, 0.8);
    color: var(--color-parchment);
    font-size: 1rem;
}

.filter-bar input[type="text"] {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--color-ocean);
    background: rgba(7, 59, 76, 0.8);
    color: var(--color-parchment);
    font-size: 1rem;
    min-width: 200px;
}

/* Card Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--color-dark);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 2px solid var(--color-ocean);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-parchment);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-content img {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 1rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        margin-left: 0;
        margin-top: 1rem;
        justify-content: center;
    }

    .nav-user {
        order: 2;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .form-row {
        flex-direction: column;
    }
}
