/* Base CSS - Core styles and components shared across all pages */

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

/* ====== Body Base ====== */
body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #e3d5ff 0%, #ffd4e5 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* ====== Container ====== */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ====== Animations ====== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ====== Loading States ====== */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dark);
    font-size: 1.2rem;
    font-weight: 700;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 25px;
    border: 5px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ====== Error States ====== */
.error {
    text-align: center;
    padding: 60px 20px;
    background: var(--pastel-pink);
    border-radius: 12px;
    color: var(--text-dark);
    font-size: 1.2rem;
    font-weight: 700;
    border: 3px solid var(--text-dark);
    box-shadow: 6px 6px 0 var(--text-dark);
}

/* ====== Selection Pills (Modifiers) ====== */
.selection-pill {
    display: inline-block;
    padding: 6px 14px;
    background: var(--pill-color, var(--pastel-blue));
    color: var(--pill-text, #fff);
    border: 2px solid var(--text-dark);
    border-radius: 20px;
    box-shadow: 3px 3px 0 var(--text-dark);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.selection-pill.pending {
    position: relative;
    border: 2px dashed var(--text-dark);
    background: var(--pill-color-light, rgba(147, 197, 253, 0.3));
    color: var(--text-dark);
    opacity: 0.85;
}

.selection-pill.removed {
    background: var(--pill-color-light, rgba(255, 200, 200, 0.3));
    border: 2px dashed #999;
    color: #666;
    text-decoration: line-through;
    opacity: 0.65;
}

/* ====== Vote Buttons ====== */
.voting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.vote-btn {
    background: white;
    border: 2px solid var(--text-dark);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 2px 2px 0 var(--text-dark);
    color: var(--text-dark);
}

.vote-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-dark);
}

.vote-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.vote-btn.upvote.active {
    background: #b8e6b8;
    border-color: var(--text-dark);
    box-shadow: 3px 3px 0 var(--text-dark);
}

.vote-btn.downvote.active {
    background: #ffcab0;
    border-color: var(--text-dark);
    box-shadow: 3px 3px 0 var(--text-dark);
}

.vote-count {
    font-weight: 800;
    color: var(--text-dark);
    font-size: 16px;
    background: #d4b5f7;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--text-dark);
    box-shadow: 2px 2px 0 var(--text-dark);
}

/* Page transition container */
.page-content {
    opacity: 1;
    transition: opacity 0.32s ease-in-out;
    will-change: opacity;
}

body.page-transition-init .page-content {
    opacity: 0;
}

body.page-transition-init.page-ready .page-content {
    opacity: 1;
}

body.page-transition-init.page-transitioning .page-content {
    opacity: 0;
}

/* ====== Character Cards ====== */
.character-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 6px 6px 0 var(--text-dark);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 3px solid var(--text-dark);
    position: relative;
    overflow: hidden;
}

.character-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0 var(--text-dark);
}

.character-image {
    width: calc(100% + 50px);
    height: 400px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    margin: -25px -25px 20px -25px;
    border-bottom: 3px solid var(--text-dark);
}

/* ====== Toast Notifications ====== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1050;
    pointer-events: none;
}

.toast {
    background: #ffffff;
    border: 3px solid var(--text-dark);
    border-radius: 14px;
    box-shadow: 6px 6px 0 var(--text-dark);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 260px;
    max-width: 360px;
    color: var(--text-dark);
    pointer-events: auto;
    animation: toast-enter 0.22s ease-out both;
}

.toast.toast--error {
    background: #ffe5ec;
    border-color: #ec407a;
    box-shadow: 6px 6px 0 #c2185b;
}

.toast.toast--success {
    background: #e7f9ed;
    border-color: #2e7d32;
    box-shadow: 6px 6px 0 #1b5e20;
}

.toast.toast--info {
    background: #e5f0ff;
    border-color: #1e88e5;
    box-shadow: 6px 6px 0 #0d47a1;
}

.toast__icon {
    font-size: 1.4rem;
    line-height: 1;
    margin-top: 2px;
}

.toast__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast__message {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.toast__details {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.3;
}

.toast__close {
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: inherit;
    padding: 2px;
    margin-left: 6px;
}

.toast-leaving {
    animation: toast-exit 0.2s ease-in forwards;
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-exit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }
}

.character-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #333;
    text-align: center;
}

.character-catchphrase {
    font-style: italic;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    padding: 10px 15px;
    background: #f4a6cd;
    border-radius: 8px;
    border: 2px solid var(--text-dark);
    box-shadow: 2px 2px 0 var(--text-dark);
}

.character-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.character-details {
    font-size: 13px;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding: 12px;
    background: #f5d982;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    border: 2px solid var(--text-dark);
    box-shadow: 2px 2px 0 var(--text-dark);
}

.no-image {
    width: calc(100% + 50px);
    height: 400px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    margin: -25px -25px 20px -25px;
    font-size: 2rem;
    border-bottom: 3px solid var(--text-dark);
}

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

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

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border: 3px solid var(--text-dark);
    box-shadow: 8px 8px 0 var(--text-dark);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f4a6cd;
    border: 2px solid var(--text-dark);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0 var(--text-dark);
    transition: all 0.2s ease;
}

.modal-close:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-dark);
}

.modal-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 15px;
    text-align: center;
}

.modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid var(--text-dark);
    box-shadow: 3px 3px 0 var(--text-dark);
    margin-bottom: 20px;
}

.modal-catchphrase {
    font-style: italic;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    padding: 12px 20px;
    background: #f4a6cd;
    border-radius: 8px;
    border: 2px solid var(--text-dark);
    box-shadow: 2px 2px 0 var(--text-dark);
}

.modal-description {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
}

.modal-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

/* ====== Camera Capture Overlay ====== */
body.camera-capture-open {
    overflow: hidden;
}

.camera-capture-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(32, 28, 56, 0.72);
    z-index: 11000;
}

.camera-capture-overlay[hidden] {
    display: none !important;
}

.camera-capture-modal {
    width: min(520px, 100%);
    background: var(--bg-subtle);
    border: 3px solid var(--text-dark);
    border-radius: 18px;
    box-shadow: 10px 10px 0 var(--text-dark);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: fadeIn 0.25s ease-out;
    position: relative;
}

.camera-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.camera-modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.camera-close-btn {
    background: var(--pastel-pink);
    border: 2px solid var(--text-dark);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--text-dark);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.camera-close-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--text-dark);
}

.camera-video-wrapper {
    position: relative;
    border: 2px dashed var(--text-dark);
    border-radius: 16px;
    background: var(--bg-cream);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
}

.camera-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-permission-tip {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 2px solid var(--text-dark);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-dark);
    box-shadow: 3px 3px 0 var(--text-dark);
}

.camera-modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.camera-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px solid var(--text-dark);
    border-radius: 12px;
    background: var(--muted-gray);
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--text-dark);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.camera-action-btn i {
    font-size: 1.1rem;
}

.camera-action-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--text-dark);
}

.camera-action-primary {
    background: var(--pastel-blue);
}

@media (max-width: 540px) {
    .camera-capture-modal {
        padding: 18px;
        box-shadow: 6px 6px 0 var(--text-dark);
    }

    .camera-modal-actions {
        justify-content: center;
    }

    .camera-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ====== Placeholder States ====== */
.placeholder {
    text-align: center;
    color: #999;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.placeholder p {
    font-size: 1rem;
    margin: 0;
}

/* ====== Responsive Breakpoints ====== */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 0 10px;
    }

    .character-card {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 999px) {
    body .navbar {
        display: none;
    }
}
