/* Aorna Search Engine - Main Stylesheet with Dark/Light Mode Support */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Colors */
    --primary-color: #4f46e5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    /* Light Mode */
    --light-bg: #f9fafb;
    --light-card-bg: #ffffff;
    --light-text: #111827;
    --light-text-secondary: #6b7280;
    --light-border: #e5e7eb;
    --light-shadow: rgba(0, 0, 0, 0.1);
    --light-nav-bg: #ffffff;
    
    /* Dark Mode */
    --dark-bg: #0f172a;
    --dark-card-bg: #1e293b;
    --dark-text: #f1f5f9;
    --dark-text-secondary: #cbd5e1;
    --dark-border: #334155;
    --dark-shadow: rgba(0, 0, 0, 0.3);
    --dark-nav-bg: #1e293b;
    
    /* Active Theme (defaults to light) */
    --bg-color: var(--light-bg);
    --card-bg: var(--light-card-bg);
    --text-color: var(--light-text);
    --text-secondary: var(--light-text-secondary);
    --border-color: var(--light-border);
    --shadow: var(--light-shadow);
    --nav-bg: var(--light-nav-bg);
    
    --transition: all 0.3s ease;
}

/* Dark Mode Theme */
body.dark-mode {
    --bg-color: var(--dark-bg);
    --card-bg: var(--dark-card-bg);
    --text-color: var(--dark-text);
    --text-secondary: var(--dark-text-secondary);
    --border-color: var(--dark-border);
    --shadow: var(--dark-shadow);
    --nav-bg: var(--dark-nav-bg);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

body.dark-mode {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Navigation */
nav {
    background: var(--nav-bg);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

nav .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img {
    max-height: 32px;
    width: auto;
}

nav .nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

nav a:hover {
    color: var(--primary-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-color);
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.theme-toggle:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

body.dark-mode .theme-toggle:hover {
    background: var(--dark-card-bg);
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    color: white;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: 2rem auto;
}

.search-box input {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box button {
    padding: 1rem 2rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px var(--shadow);
    padding: 1.5rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.card:hover {
    box-shadow: 0 10px 25px var(--shadow);
    transform: translateY(-5px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-color);
}

.card-body {
    margin: 1rem 0;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

input, textarea, select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-color);
}

input::placeholder, textarea::placeholder {
    color: var(--text-secondary);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--text-color);
}

body.dark-mode th {
    background: var(--dark-card-bg);
}

tr:hover {
    background: var(--light-bg);
}

body.dark-mode tr:hover {
    background: var(--dark-card-bg);
}

/* Search Results */
.search-results {
    max-width: 600px;
    margin: 2rem auto;
}

.result-item {
    background: var(--card-bg);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.result-item:hover {
    box-shadow: 0 5px 15px var(--shadow);
}

.result-url {
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.result-title a {
    color: var(--text-color);
    text-decoration: none;
}

.result-title a:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

.result-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Ads */
.ad-container {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    color: #92400e;
}

body.dark-mode .ad-container {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.ad-container a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--secondary-color);
}

body.dark-mode .alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #7f1d1d;
    border-left: 4px solid var(--danger-color);
}

body.dark-mode .alert-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

body.dark-mode .alert-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px var(--shadow);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: var(--dark-card-bg);
    color: var(--text-color);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Responsive */
/* ==================== RESPONSIVE MOBILE DESIGN ==================== */

/* Extra Large Screens (1200px+) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Screens (769px - 1199px) - Tablets & Desktops */
@media (min-width: 769px) and (max-width: 1199px) {
    .container {
        max-width: 900px;
        padding: 0 1.5rem;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-responsive {
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 12px;
    }
}

/* Medium Screens (481px - 768px) - Tablets & Large Phones */
@media (max-width: 768px) {
    /* Typography */
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Navigation */
    nav .container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    nav .nav-links {
        width: 100%;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .nav-right {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    /* Search Box */
    .search-box {
        flex-direction: column;
        max-width: 100%;
        margin: 1rem 0;
    }
    
    .search-box input {
        width: 100%;
    }
    
    /* Cards & Grids */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .card-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Forms */
    form {
        gap: 0.75rem;
    }
    
    .form-group {
        flex-direction: column;
    }
    
    .form-group.inline {
        flex-direction: column;
    }
    
    input, select, textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 14px;
    }
    
    .btn-sm {
        width: auto;
        padding: 0.5rem 0.75rem;
        font-size: 12px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        font-size: 13px;
    }
    
    table {
        width: 100%;
    }
    
    table thead {
        font-size: 12px;
    }
    
    table td, table th {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Modal/Popups */
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        border-radius: 0.5rem;
    }
    
    /* Sidebars */
    .sidebar {
        display: none; /* Hide on mobile unless explicitly shown */
    }
    
    .sidebar.mobile-open {
        display: block;
        position: absolute;
        width: 100%;
        z-index: 999;
    }
    
    /* Spacing adjustments */
    .container {
        padding: 0 1rem;
    }
    
    .mt-lg {
        margin-top: 1rem;
    }
    
    .mb-lg {
        margin-bottom: 1rem;
    }
    
    .px-lg {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Hide unnecessary elements on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Flexbox adjustments */
    .flex-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Badge sizing */
    .badge {
        font-size: 11px;
        padding: 0.25rem 0.5rem;
    }
    
    /* Lists */
    ul, ol {
        padding-left: 1.5rem;
    }
    
    li {
        margin-bottom: 0.5rem;
    }
}

/* Small Screens (320px - 480px) - Mobile Phones */
@media (max-width: 480px) {
    /* Typography */
    .hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    /* Navigation */
    nav .container {
        padding: 0.75rem;
    }
    
    nav .logo {
        font-size: 1.25rem;
    }
    
    nav .nav-links {
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 13px;
    }
    
    /* Search Box */
    .search-box {
        margin: 0.5rem 0;
        gap: 0.25rem;
    }
    
    .search-box input {
        padding: 0.65rem;
        font-size: 16px;
    }
    
    .search-box button {
        padding: 0.65rem 1rem;
    }
    
    /* Cards */
    .card {
        padding: 0.75rem;
        margin: 0.5rem 0;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    /* Forms */
    input, select, textarea {
        padding: 0.65rem;
        font-size: 16px; /* Critical for iOS */
        border-radius: 0.35rem;
    }
    
    label {
        font-size: 0.95rem;
        margin-bottom: 0.35rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.65rem 1rem;
        font-size: 14px;
        border-radius: 0.35rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 11px;
    }
    
    /* Tables */
    table {
        font-size: 12px;
    }
    
    table td, table th {
        padding: 0.35rem;
    }
    
    /* Spacing */
    .container {
        padding: 0 0.75rem;
    }
    
    .mt-1 {
        margin-top: 0.5rem;
    }
    
    .mb-1 {
        margin-bottom: 0.5rem;
    }
    
    /* Grid columns */
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    /* Display helpers */
    .hide-mobile-small {
        display: none !important;
    }
    
    /* Modals take full width */
    .modal {
        width: 95vw !important;
        margin: auto !important;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Landscape Mode (Mobile) */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 1rem 0;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    nav .container {
        padding: 0.5rem 1rem;
    }
    
    .search-box {
        margin: 0.5rem auto;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch target size to 44x44px minimum */
    .btn, button, a[role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    nav, .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    table {
        page-break-inside: avoid;
    }
}

