/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Vibrant & Gamified */
    --primary: #FF7E5F;
    --primary-dark: #FE633D;
    --secondary: #FEB47B;
    --accent: #4DE1C1;
    --background: #F4F7FE;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-solid: #FFFFFF;
    --text-main: #2B3674;
    --text-muted: #A3AED0;
    --danger: #FF5B5B;
    --success: #05CD99;
    --warning: #FFCE20;

    /* Shadows & Glassmorphism */
    --shadow-soft: 0px 10px 30px rgba(43, 54, 116, 0.05);
    --shadow-hover: 0px 15px 40px rgba(255, 126, 95, 0.2);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    
    /* Layout */
    --border-radius: 20px;
    --border-radius-sm: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
}

body {
    background-color: var(--background);
    background-image: radial-gradient(circle at top left, rgba(255, 126, 95, 0.15), transparent 40%),
                      radial-gradient(circle at bottom right, rgba(77, 225, 193, 0.15), transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 700;
}

p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Glassmorphism Container */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: 2rem;
    transition: all 0.3s ease;
}

.glass-panel:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 1rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 126, 95, 0.3);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.4);
    color: white;
}

.btn-line {
    background: #00B900;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 185, 0, 0.3);
}

.btn-line:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 185, 0, 0.4);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border: 2px solid rgba(43, 54, 116, 0.1);
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    font-family: 'Prompt', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 126, 95, 0.1);
    background: #fff;
}

/* Mascot Wrapper */
.mascot-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.mascot-img {
    max-width: 150px;
    height: auto;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0px 10px 15px rgba(255, 126, 95, 0.2));
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

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

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* Responsive Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-sm);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}
.table-responsive table {
    min-width: 600px; /* Prevent tables from squeezing too much */
}

/* =========================================
   📱 Mobile-First UX/UI (LINE OA Optimized)
   ========================================= */
@media (max-width: 768px) {
    /* 1. Main Container */
    div.dashboard-container {
        display: block !important;
        min-height: 100vh !important;
        padding-bottom: 80px !important; /* Space for Bottom Nav */
    }

    /* 2. Transform Sidebar into Bottom Navigation */
    aside.sidebar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 75px !important;
        padding: 0 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        border-top: 1px solid rgba(43, 54, 116, 0.1) !important;
        border-right: none !important;
        border-bottom: none !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-around !important;
        z-index: 1000 !important;
        border-radius: 24px 24px 0 0 !important;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.05) !important;
    }

    /* Hide Logo and Toggle Button on Mobile */
    aside.sidebar .logo-area, .toggle-sidebar-btn {
        display: none !important;
    }

    /* 3. Bottom Nav Items Layout */
    aside.sidebar nav {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        height: 100% !important;
        justify-content: space-around !important;
        align-items: center !important;
        margin: 0 !important;
        padding: 0 10px !important;
    }

    aside.sidebar nav a.nav-item {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px 2px !important;
        margin: 0 !important;
        gap: 2px !important;
        border: none !important;
        border-radius: 12px !important;
        background: transparent !important;
        color: var(--text-muted) !important;
        position: relative !important;
        min-width: 0 !important; /* Allow shrinking below text size */
    }

    /* Active State for Bottom Nav */
    aside.sidebar nav a.nav-item.active {
        color: var(--primary) !important;
        transform: none !important;
        background: transparent !important;
    }
    aside.sidebar nav a.nav-item.active::after {
        content: '';
        position: absolute;
        top: -2px;
        width: 30px;
        height: 4px;
        background: var(--primary);
        border-radius: 4px;
    }

    aside.sidebar nav a.nav-item svg {
        width: 22px !important;
        height: 22px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    aside.sidebar nav a.nav-item span {
        display: block !important;
        font-size: 0.55rem !important; /* Smaller font for 5 items */
        font-weight: 600 !important;
        white-space: normal !important; /* Allow wrap */
        text-align: center !important;
        line-height: 1.2 !important;
        width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
    }

    /* Hide Logout button text or change it to just an icon, or keep it */
    aside.sidebar nav a.nav-item[href="logout.php"] {
        display: none !important; /* Usually no logout in bottom nav for LIFF */
    }

    /* 4. Main Content Full Width */
    main.main-content {
        padding: 1.2rem 1rem !important;
        width: 100% !important;
        height: auto !important;
        overflow-y: visible !important;
    }

    /* 5. Header Adjustments */
    header.top-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 1.5rem !important;
    }
    header.top-header h1 {
        font-size: 1.4rem !important;
    }
    .user-profile {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.8rem !important;
    }

    /* 6. Cards and Grids App-Like */
    .quick-actions-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* 2x2 Grid on Mobile */
        gap: 10px !important;
    }
    .action-card {
        padding: 1rem !important;
        border-radius: 16px !important;
    }
    .action-title {
        font-size: 1.1rem !important;
        margin-bottom: 5px !important;
        text-align: center !important;
        justify-content: center !important;
        flex-direction: column !important;
        gap: 5px !important;
    }
    .action-desc {
        display: none !important; /* Hide text to make it look like app icons */
    }
    .btn-action {
        width: 100% !important;
        font-size: 0.85rem !important;
        padding: 0.5rem !important;
        justify-content: center !important;
    }

    .class-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    .d-flex.justify-between.mb-4,
    div[style*="display:flex; justify-content:space-between; align-items:center; margin-bottom:2rem;"],
    div[style*="display:grid; grid-template-columns:1fr 1fr;"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    /* Touch Targets & Forms */
    .btn, .btn-action, .form-control, .form-select {
        min-height: 48px !important;
        width: 100% !important;
        justify-content: center !important;
        font-size: 1rem !important;
    }

    .modal-card, .card-form, .table-card {
        padding: 1.2rem !important;
        width: 100% !important;
        border-radius: 20px !important;
    }
}
