/* Base Design System - Standardized across all pages */

/* ═══════════════════════════════════════════════════════════════════════════════════════ */
/* KEYFRAMES & ANIMATIONS */
/* ═══════════════════════════════════════════════════════════════════════════════════════ */
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px #219b9d; }
    50% { box-shadow: 0 0 20px #219b9d; }
    100% { box-shadow: 0 0 5px #219b9d; }
}

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

@keyframes solvedPulse {
    0% { box-shadow: 0 0 0 0 rgba(253,126,20,.8); }
    70% { box-shadow: 0 0 20px 12px rgba(253,126,20,0); }
    100% { box-shadow: 0 0 0 0 rgba(253,126,20,0); }
}

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

/* ═══════════════════════════════════════════════════════════════════════════════════════ */
/* COLOR VARIABLES */
/* ═══════════════════════════════════════════════════════════════════════════════════════ */
:root {
    --primary-bg: #0a0f1a;
    --secondary-bg: #131b2b;
    --accent-purple: #8c52ff;
    --accent-teal: #219b9d;
    --accent-orange: #fd7e14;
    --accent-green: #28a745;
    --border-color: #1f2a3e;
    --text-primary: #fff;
    --text-secondary: #bbbbbb;
    --text-muted: #ddd;
    --success-bg: rgba(40, 167, 69, 0.1);
    --error-bg: rgba(220, 53, 69, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════════════════ */
/* COMMON COMPONENTS */
/* ═══════════════════════════════════════════════════════════════════════════════════════ */

/* Base page styling */
.fade-in {
    animation: slideInUp 0.8s ease-out;
}

/* Card styling */
.card {
    background: linear-gradient(145deg, var(--secondary-bg), var(--primary-bg));
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    padding: 20px;
    color: var(--text-primary);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--accent-purple);
}

/* Button styling */
.button {
    background: var(--accent-teal);
    color: var(--text-primary);
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

/* Form inputs */
.form-input {
    background: var(--primary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

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

.form-input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(33,155,157,0.7);
}

/* Spinner */
.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: var(--accent-teal);
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

/* Success/Error messaging */
.message-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    animation: slideInDown 0.5s ease-out;
}

.message-card {
    padding: 15px 25px;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.message-card.success {
    background: var(--success-bg);
    border: 1px solid var(--accent-green);
}

.message-card.error {
    background: var(--error-bg);
    border: 1px solid #dc3545;
}

/* Instance Services Styling */
.instance-services {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border-left: 3px solid var(--accent-teal);
}

.service-item:last-child {
    margin-bottom: 0;
}

.service-item strong {
    color: var(--accent-purple);
    font-size: 12px;
    min-width: 60px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.instance-link {
    color: var(--accent-teal);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.instance-link:hover {
    color: var(--accent-orange);
    text-decoration: underline;
}

.ssh-command {
    background: var(--border-color);
    color: var(--accent-green);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ssh-command:hover {
    background: rgba(33, 155, 157, 0.2);
}

.copy-icon {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.copy-icon:hover {
    color: var(--accent-teal);
}

.instance-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-green);
    font-weight: 500;
    padding: 8px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--accent-green);
}

.instance-info {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════════════════ */
/* UNIFIED CHALLENGE CARD DESIGN */
/* ═══════════════════════════════════════════════════════════════════════════════════════ */

.challenge-card {
    background: linear-gradient(145deg, var(--secondary-bg), var(--primary-bg));
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: slideInUp 0.8s ease-out;
    border: 2px solid var(--accent-purple);
}

.challenge-card:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--accent-purple);
}

.challenge-card.expanded {
    grid-column: 1 / -1;
    transform: scale(1.02);
}

.challenge-card.solved {
    animation: solvedPulse 1s ease-out 3;
}

/* Solved badge */
.solved-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent-teal);
    color: var(--text-primary);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 3px;
    animation: glow 2s infinite;
    transition: all 0.25s ease;
}

/* Premium badge */
.premium-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-orange);
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Collapsed state → shrink into round check-mark */
.challenge-card:not(.expanded) .solved-tag {
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.challenge-card:not(.expanded) .solved-tag::before {
    content: "✓";
    font-size: 18px;
    line-height: 1;
    color: var(--text-primary);
}

/* Header */
.challenge-header {
    text-align: center;
}

.challenge-title {
    font-size: 24px;
    color: var(--accent-purple);
    margin-bottom: 10px;
}

/* Category badges */
.cat-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 8px;
}

.cat-tag {
    display: inline-block;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: lowercase;
    border-radius: 3px;
    color: var(--text-primary);
    user-select: none;
}

.cat-web { background: var(--accent-purple); }
.cat-pwn { background: #e83e8c; }
.cat-re { background: #6f42c1; }
.cat-crypto { background: #ffc107; color: #000; }
.cat-misc { background: var(--accent-green); }
.cat-forensics { background: var(--accent-orange); color: #000; }
.cat-tag:not([class*="cat-"]) { background: #444; }

/* Body expand */
.challenge-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s, opacity 0.3s;
}

.challenge-card.expanded .challenge-body {
    max-height: 1000px;
    opacity: 1;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@keyframes solvedPulse {
    0% { box-shadow: 0 0 0 0 rgba(33,155,157,0.8); }
    70% { box-shadow: 0 0 20px 12px rgba(33,155,157,0); }
    100% { box-shadow: 0 0 0 0 rgba(33,155,157,0); }
}

/* Title styling */
.page-title {
    font-size: 32px;
    color: var(--accent-purple);
    text-align: center;
    margin-bottom: 25px;
    animation: slideInUp 0.8s ease-out;
}

/* Form group */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-green);
}

/* Grid layouts */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    animation: slideInUp 0.8s ease-out;
}

.tile {
    background: linear-gradient(145deg, var(--secondary-bg), var(--primary-bg));
    border: 2px solid var(--accent-purple);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    cursor: pointer;
}

.tile:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--accent-purple);
    border-color: var(--accent-orange);
}

.tile-icon {
    font-size: 40px;
    margin-bottom: 15px;
    color: var(--accent-teal);
}

.tile h3 {
    font-size: 24px;
    color: var(--accent-purple);
    margin-bottom: 10px;
}

.tile p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Hero section */
.hero-section {
    background: var(--primary-bg);
    padding: 40px 20px;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    color: var(--accent-purple);
    animation: slideInUp 0.8s ease-out;
}

/* Content wrapper */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Section styling */
.content-section {
    margin-bottom: 40px;
    padding: 20px 10px;
}

.section-title {
    font-size: 30px;
    color: var(--text-primary);
    text-transform: lowercase;
    font-weight: 700;
    margin-bottom: 15px;
    padding-left: 8px;
    border-left: 4px solid var(--accent-purple);
}

/* Responsive design */
@media (max-width: 768px) {
    .hero-title { font-size: 36px; }
    .page-title { font-size: 26px; }
    .content-grid { grid-template-columns: 1fr; }
    .tile { padding: 15px; }
    .tile h3 { font-size: 20px; }
}