/* ============================================
   SpongeBob Tower Defense Codes - Main Stylesheet
   ============================================ */

:root {
    --primary-color: #FFD84D;
    --secondary-color: #0B2740;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;
    --light-bg: #F5F5F5;
    --white: #FFFFFF;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #DDDDDD;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--light-bg);
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-color);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #1a3a52 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo:hover {
    opacity: 0.9;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--white);
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover,
nav a.active {
    color: var(--primary-color);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #FFE680 100%);
    color: var(--secondary-color);
    padding: 3rem 1rem;
    text-align: center;
    border-bottom: 4px solid var(--secondary-color);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* ============================================
   SEARCH & FILTER SECTION
   ============================================ */

.search-filter-section {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.search-box {
    margin-bottom: 2rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 8px rgba(11, 39, 64, 0.2);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--primary-color);
    background-color: var(--white);
    color: var(--secondary-color);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ============================================
   CODES GRID & CARDS
   ============================================ */

.codes-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

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

.code-card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 5px solid var(--primary-color);
    position: relative;
}

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

.code-card.expired {
    opacity: 0.7;
    border-left-color: var(--danger-color);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.code-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--secondary-color);
    font-family: 'Courier New', monospace;
}

.code-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-active {
    background-color: var(--success-color);
    color: var(--white);
}

.badge-expired {
    background-color: var(--danger-color);
    color: var(--white);
}

.badge-reward {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    display: inline-block;
    margin-bottom: 1rem;
}

.code-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.code-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.expires-date {
    color: var(--text-light);
}

.expires-date.soon {
    color: var(--warning-color);
    font-weight: bold;
}

.code-actions {
    display: flex;
    gap: 1rem;
    justify-content: center; /* center actions (copy button) */
}

.btn {
    /* default buttons (used in forms, admin actions) */
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.code-actions .btn {
    /* Do not stretch action buttons inside code cards; keep centered */
    flex: 0 0 auto;
    min-width: 140px;
}

.btn-copy {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

.btn-copy:hover {
    background-color: #FFE680;
    transform: scale(1.05);
}

.btn-claim {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-claim:hover {
    background-color: #1a3a52;
    transform: scale(1.05);
}

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

.btn-primary:hover {
    background-color: #FFE680;
}

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

.btn-secondary:hover {
    background-color: #1a3a52;
}

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

.btn-success:hover {
    background-color: #45a049;
}

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

.btn-danger:hover {
    background-color: #da190b;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 216, 77, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-submit {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-submit:hover {
    background-color: #FFE680;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Contact card (simple mail link) */
.contact-card {
    max-width: 720px;
    margin: 2rem auto;
    background-color: var(--white);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

/* Example code hint styling (small brownish code-like block) */
.example-code {
    margin-top: 0.75rem;
    display: inline-block;
}
.example-label {
    font-size: 0.8rem;
    color: #6b4a00; /* dark-brown label */
    margin-bottom: 0.25rem;
}
.example-snippet {
    display: inline-block;
    background: linear-gradient(180deg, #f3e7c2 0%, #ead9b0 100%); /* warm/brownish */
    color: #5a3d00;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.04);
}

.contact-card .contact-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.contact-card h2 {
    margin-bottom: 0.25rem;
    color: var(--secondary-color);
}

.contact-mail {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.contact-mail:hover {
    /* Ensure strong contrast on hover so text remains readable */
    background-color: var(--secondary-color);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   ALERT MESSAGES
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: inherit;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 4px solid var(--primary-color);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--white);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.disclaimer {
    font-size: 0.85rem;
    margin-top: 1rem;
    opacity: 0.8;
}



/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .codes-grid {
        grid-template-columns: 1fr;
    }

    .filter-buttons {
        justify-content: center;
    }

    .footer-container {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 0.9rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .code-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .search-box input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    nav ul {
        gap: 0.5rem;
    }

    nav a {
        font-size: 0.9rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

.text-center {
    text-align: center;
}

.text-primary {
    color: var(--primary-color);
}

.text-secondary {
    color: var(--secondary-color);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-indicator {
    margin-bottom: 1.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-badge.status-active {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.status-badge.status-expired {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

/* ============================================
   GAME CODES GRID
   ============================================ */

.game-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    background: #f8f9fa;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-card .card-title {
    color: #2c3e50;
    font-weight: 600;
}

.game-card .card-text {
    color: #666;
}

.game-card .btn-primary {
    background-color: #3498db;
    border: none;
    transition: background-color 0.2s;
}

.game-card .btn-primary:hover {
    background-color: #2980b9;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    header,
    footer,
    .search-filter-section,
    .code-actions {
        display: none;
    }

    .code-card {
        page-break-inside: avoid;
    }
}
