/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    color: #1A2A4A;
    line-height: 1.5;
    font-size: 16px;
}

/* ===== MOBILE-FIRST LAYOUT ===== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar - hidden by default on mobile */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: #1A2A4A;
    color: white;
    padding: 20px;
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}

.sidebar.open {
    left: 0;
}

/* Hamburger button */
.menu-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #FF6B35;
    border: none;
    color: white;
    font-size: 24px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Overlay when sidebar opens */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 70px 15px 20px 15px;
    background: #f4f6f9;
    width: 100%;
}

/* ===== SIDEBAR STYLES ===== */
.sidebar-brand {
    margin-bottom: 30px;
    text-align: center;
}

.sidebar-brand h2 {
    color: #FF6B35;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.sidebar-brand small a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.75rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    padding: 12px 15px;
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: background 0.2s;
    font-size: 1rem;
}

.sidebar-nav a:hover, 
.sidebar-nav a.active {
    background: #FF6B35;
}

.sidebar-footer {
    border-top: 1px solid #334155;
    padding-top: 20px;
    margin-top: 20px;
    font-size: 0.85rem;
}

.credit-info, .plan-badge {
    margin-bottom: 10px;
    padding: 8px;
    background: #0f1a2e;
    border-radius: 8px;
    text-align: center;
}

/* ===== CARDS & CONTAINERS ===== */
.assistant-card, .dashboard-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.avatar {
    text-align: center;
    margin-bottom: 20px;
}

.avatar span {
    font-size: 3.5rem;
}

.avatar h2 {
    font-size: 1.6rem;
    margin-top: 5px;
}

.warning-banner {
    background: #fff3cd;
    border-left: 5px solid #FF6B35;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #856404;
}

/* ===== FORMS ===== */
.question-box textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    font-family: inherit;
    resize: vertical;
    margin-top: 8px;
}

.upload-box {
    margin: 15px 0;
}

.upload-box input[type="file"] {
    margin-top: 8px;
    font-size: 14px;
}

button, .button {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 40px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    transition: background 0.2s;
    min-height: 48px; /* Touch-friendly */
}

button:hover {
    background: #e05a2a;
}

/* ===== RESULTS ===== */
.result {
    margin-top: 25px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 16px;
}

.answer {
    background: #e9ecef;
    padding: 15px;
    border-radius: 12px;
    margin: 10px 0;
    font-weight: 500;
    word-wrap: break-word;
}

.steps {
    background: white;
    padding: 15px;
    border-radius: 12px;
    line-height: 1.6;
    word-wrap: break-word;
}

.ethics-note {
    margin-top: 15px;
    font-size: 0.75rem;
    color: #dc3545;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 16px;
    margin-top: 20px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 10px;
    margin-top: 15px;
}

/* ===== FOOTER ===== */
.main-footer {
    background: white;
    padding: 15px;
    text-align: center;
    font-size: 0.7rem;
    color: #6c757d;
    border-radius: 16px;
    margin-top: 20px;
}

.main-footer a {
    color: #FF6B35;
    text-decoration: none;
}

/* ===== HEADER ===== */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.welcome-text h1 {
    font-size: 1.3rem;
}

.credit-badge {
    background: #FF6B35;
    padding: 6px 12px;
    border-radius: 40px;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ===== TABLES (responsive) ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* ===== BOTTOM NAVIGATION FOR MOBILE ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: none;
    justify-content: space-around;
    padding: 8px 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    border-top: 1px solid #eee;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
    text-decoration: none;
    font-size: 0.7rem;
    gap: 4px;
}

.bottom-nav a.active {
    color: #FF6B35;
}

.bottom-nav span {
    font-size: 1.4rem;
}

/* ===== MEDIA QUERIES ===== */

/* Tablet and up */
@media (min-width: 768px) {
    .app-wrapper {
        flex-direction: row;
    }
    
    .menu-toggle, .overlay, .bottom-nav {
        display: none;
    }
    
    .sidebar {
        position: relative;
        left: 0;
        width: 280px;
        height: auto;
        min-height: 100vh;
    }
    
    .main-content {
        padding: 20px 30px;
        margin-left: 0;
    }
    
    button, .button {
        width: auto;
        min-width: 200px;
    }
    
    .assistant-card {
        padding: 30px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .main-content {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .assistant-card, .dashboard-card {
        padding: 15px;
    }
    
    .avatar span {
        font-size: 2.8rem;
    }
    
    .avatar h2 {
        font-size: 1.3rem;
    }
    
    .sidebar {
        width: 260px;
    }
}

/* Show bottom nav only on mobile */
@media (max-width: 767px) {
    .bottom-nav {
        display: flex;
    }
    
    .main-content {
        padding-bottom: 70px;
    }
}