/* Carnatic Music Portal - Styles */

:root {
    --primary: #6B46C1;
    --primary-dark: #553C9A;
    --secondary: #ED8936;
    --bg-light: #F7FAFC;
    --bg-white: #FFFFFF;
    --text-dark: #2D3748;
    --text-muted: #718096;
    --border: #E2E8F0;
    --success: #48BB78;
    --warning: #ECC94B;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: var(--primary);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.navbar .container {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: white;
}

.search-form {
    display: flex;
    margin-left: auto;
}

.search-form input {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px 0 0 4px;
    width: 250px;
}

.search-form button {
    padding: 0.5rem 1rem;
    background: var(--secondary);
    border: none;
    border-radius: 0 4px 4px 0;
    color: white;
    cursor: pointer;
}

/* Main content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

/* Song list */
.song-grid {
    display: grid;
    gap: 1rem;
}

.song-item {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.song-item:hover {
    box-shadow: var(--shadow-lg);
}

.song-item h3 {
    margin-bottom: 0.5rem;
}

.song-item h3 a {
    color: var(--primary);
    text-decoration: none;
}

.song-item h3 a:hover {
    text-decoration: underline;
}

.song-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.song-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #C6F6D5;
    color: #22543D;
}

.badge-warning {
    background: #FEFCBF;
    color: #744210;
}

.badge-muted {
    background: var(--border);
    color: var(--text-muted);
}

/* Home page */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-card .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

/* Browse lists */
.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.browse-item {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.2s, box-shadow 0.2s;
}

.browse-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.browse-item h3 {
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.browse-item .count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Song detail page */
.song-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.song-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.song-header-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    opacity: 0.9;
}

.lyrics-section, .notation-section, .meaning-section {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.2rem;
    color: var(--primary);
}

.lyrics-content {
    white-space: pre-wrap;
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    line-height: 1.8;
}

.lyrics-label {
    font-weight: bold;
    color: var(--primary);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Search results */
.search-results-header {
    margin-bottom: 1.5rem;
}

mark {
    background: #FEFCBF;
    padding: 0 0.2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a, .pagination span {
    padding: 0.5rem 1rem;
    background: var(--bg-white);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-dark);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
}

.pagination .current {
    background: var(--primary);
    color: white;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: rgba(255,255,255,0.7);
    padding: 2rem 0;
    text-align: center;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #CBD5E0;
}

/* ===== MOBILE IMPROVEMENTS ===== */

/* Logo styles */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img {
    height: 40px;
    border-radius: 4px;
}

.logo-text {
    font-weight: bold;
}

.logo-text-container {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-source {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* Hamburger menu button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Mobile slide-out menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    z-index: 1001;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
}

.mobile-menu.open {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--primary);
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

.close-menu {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.mobile-menu-links {
    padding: 0.5rem 0;
}

.mobile-menu-links a {
    display: block;
    padding: 1rem 1.25rem;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.mobile-menu-links a:hover,
.mobile-menu-links a:active {
    background: var(--bg-light);
}

.mobile-menu-links hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 0.5rem 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Bottom navigation (mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    min-height: 56px;
    transition: color 0.2s;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--primary);
}

.bottom-nav-icon {
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
}

.bottom-nav-label {
    font-weight: 500;
}

/* Footer styles */
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-logo {
    height: 50px;
    border-radius: 4px;
}

.footer-text p {
    margin: 0;
}

.footer-sub {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Table scroll wrapper for mobile */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.table-scroll table {
    min-width: 600px;
}

/* Better touch targets */
a, button, input[type="submit"], input[type="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Responsive breakpoints */
@media (max-width: 768px) {
    /* Hide desktop nav, show hamburger */
    .desktop-nav {
        display: none !important;
    }
    
    .hamburger {
        display: flex;
    }
    
    /* Show bottom nav */
    .bottom-nav {
        display: flex;
    }
    
    /* Add padding for bottom nav */
    .main-content {
        padding-bottom: 70px;
    }
    
    .footer {
        padding-bottom: 70px;
    }
    
    /* Navbar adjustments */
    .navbar .container {
        flex-wrap: nowrap;
        gap: 0.75rem;
    }
    
    .logo-text-container {
        display: none;
    }
    
    .logo-img {
        height: 36px;
    }
    
    /* Search form mobile */
    .search-form {
        flex: 1;
        margin-left: 0;
    }
    
    .search-form input {
        width: 100%;
        min-width: 0;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-form button {
        padding: 0.5rem;
        min-width: 44px;
    }
    
    /* Hero adjustments */
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    /* Song header */
    .song-header {
        padding: 1rem;
    }
    
    .song-header h1 {
        font-size: 1.25rem;
    }
    
    .song-header-meta {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Footer mobile */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .footer-logo {
        height: 40px;
    }
    
    .footer-text {
        font-size: 0.85rem;
    }
    
    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Tablet (iPad) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .auth-links {
        font-size: 0.9rem;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .bottom-nav, .hamburger, .mobile-menu, .btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    body {
        font-size: 12pt;
        background: white;
    }
}

/* Offline mode indicator */
body.offline::before {
    content: "You are offline - some features may not be available";
    display: block;
    background: #FED7D7;
    color: #C53030;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
}
