/* 
 * main.css - Core Design System & Variables
 * ACLC Bridge - Smooth UI, Navy Glassmorphism
 */

:root {
    /* Color Palette (Smooth Navy & Gradients) */
    --color-bg-deep: #050a15;
    --color-bg-base: #0a1329;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-secondary: #8b5cf6;
    --color-accent: #0ea5e9;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Glassmorphism Variables */
    --glass-bg: rgba(16, 28, 54, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);

    /* Typography */
    --font-heading: 'Inter', 'Noto Sans JP', sans-serif;
    --font-body: 'Inter', 'Noto Sans JP', sans-serif;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Background animated shapes */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--color-secondary) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 30px) scale(1.1);
    }
}

/* Main Container */
#app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glass Panel Component */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* Navbar */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(10, 19, 41, 0.6);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--color-primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-block {
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(5deg) scale(1.05);
}

/* Inputs */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group .material-symbols-rounded {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(255, 255, 255, 0.05);
    /* Lighter background for better contrast */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.input-group input:focus+.material-symbols-rounded {
    color: var(--color-primary);
}

/* Views & States */
.view-section {
    padding: 2rem;
    animation: fadeIn 0.4s ease-out forwards;
    display: none;
}

.view-section.active {
    display: block;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(20px);
    transition: var(--transition-bounce);
    box-shadow: var(--glass-shadow);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: var(--color-danger);
    transform: rotate(90deg);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

/* Base Select Style */
select.input-style {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    appearance: none;
}

select.input-style option {
    background: var(--color-bg-base);
    color: white;
}

/* Utilities */
.text-center {
    text-align: center;
}

.error-text {
    color: var(--color-danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.4s;
    opacity: 0;
}

.toast.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast-error {
    border-left: 4px solid var(--color-danger);
}

.toast-info {
    border-left: 4px solid var(--color-primary);
}

/* Custom Dropdown */
.custom-dropdown-container {
    position: relative;
    user-select: none;
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(10, 19, 41, 0.95);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    min-width: 160px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: var(--transition-bounce);
    z-index: 10000;
}

.custom-dropdown-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.dropdown-item.selected {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.1);
}

/* Animations and Additions */
@keyframes heart-damage {
    0% {
        transform: scale(1);
        color: var(--color-danger);
    }

    50% {
        transform: scale(1.5);
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }

    100% {
        transform: scale(1);
        color: inherit;
    }
}

.heart-anim {
    animation: heart-damage 0.5s ease;
}

.hint-box {
    background: rgba(14, 165, 233, 0.15);
    border-left: 4px solid var(--color-accent);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #e0f2fe;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.hint-box .material-symbols-rounded {
    color: var(--color-accent);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.btn-danger:active {
    transform: translateY(1px);
}

/* Custom Scrollbar Elements */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: var(--radius-full);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.8);
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass-border);
    transition: .4s;
    border-radius: 24px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.slider {
    background-color: var(--color-success);
}

.toggle-switch input:checked+.slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Mobile Bottom Navigation */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(10px);
        margin: 0 !important;
        padding: 0.5rem 0 !important;
        border-bottom: none !important;
        border-top: 1px solid var(--glass-border);
        z-index: 1000;
        display: flex;
        justify-content: space-around !important;
        /* SafeArea insets for iOS */
        padding-bottom: env(safe-area-inset-bottom) !important;
    }

    .mobile-bottom-nav button {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.2rem !important;
        font-size: 0.85rem !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        border-bottom: none !important;
        color: var(--text-muted) !important;
    }

    .mobile-bottom-nav button.active {
        color: var(--color-primary) !important;
    }

    .mobile-bottom-nav button .material-symbols-rounded {
        font-size: 1.5rem;
    }

    /* Hide the English text to save space on mobile */
    .mobile-bottom-nav button span.tab-text-en {
        display: none;
    }

    /* Add padding to the body so the bottom content is not obscured */
    body {
        padding-bottom: 80px;
    }
}

/* Skeleton Loading Animation */
@keyframes placeholderShimmer {
    0% {
        background-position: -1200px 0;
    }

    100% {
        background-position: 1200px 0;
    }
}

.skeleton {
    animation: placeholderShimmer 2s linear infinite forwards;
    background: #1e293b;
    background-image: linear-gradient(to right, #1e293b 0%, #334155 20%, #1e293b 40%, #1e293b 100%);
    background-repeat: no-repeat;
    background-size: 1200px 100%;
    border-radius: var(--radius-sm);
    display: inline-block;
    color: transparent !important;
}

.skeleton-text {
    height: 1.2rem;
    width: 60%;
}

.skeleton-badge {
    height: 1.5rem;
    width: 4rem;
}