/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --accent-primary: #3b82f6;
    --accent-secondary: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --border-color: #333333;
    --border-hover: #404040;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Light Theme Colors */
.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-primary: #2563eb;
    --accent-secondary: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    transition: all 0.3s ease;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
  display: flex;
    align-items: center;
  justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: var(--shadow-sm);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    display: none; /* Hide tagline on desktop to save space */
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.125rem;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.search-container:hover {
    box-shadow: var(--shadow-lg);
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
  align-items: center;
}

.search-icon {
    color: var(--text-muted);
    font-size: 1rem;
}

.search-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.search-button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
    border-radius: var(--radius-md);
    padding: 0.875rem 1.5rem;
    color: white;
    font-weight: 600;
  cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.search-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.search-button:active {
    transform: translateY(0);
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    color: var(--accent-danger);
    font-weight: 500;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results Container */
.results-container {
    display: grid;
    gap: 1.5rem;
}

/* Repository Card */
.repo-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.repo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.repo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-hover);
}

.repo-card:hover::before {
    opacity: 1;
}

.repo-header {
  display: flex;
    justify-content: space-between;
  align-items: flex-start;
    margin-bottom: 1.5rem;
}

.repo-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.repo-title i {
    color: var(--accent-primary);
    font-size: 1.25rem;
}

.repo-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.repo-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
  display: flex;
  align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.meta-item i {
    color: var(--accent-primary);
    width: 16px;
    text-align: center;
}

.meta-item span {
    font-weight: 500;
    color: var(--text-primary);
}

.meta-item .meta-value {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Links */
.repo-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: inline-block;
    transition: all 0.2s ease;
}

.repo-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

/* Stats */
.repo-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.stat-item i {
    font-size: 1rem;
}

.stat-stars i {
    color: var(--accent-warning);
}

.stat-forks i {
    color: var(--accent-secondary);
}

.stat-item span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Topics */
.repo-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.topic-tag {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Languages */
.repo-languages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.language-tag {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.language-primary {
    background: rgba(16, 185, 129, 0.2);
    font-weight: 600;
}

/* Dates */
.repo-dates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.date-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.date-item i {
    color: var(--text-muted);
    width: 16px;
    text-align: center;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem;
    }
    
    .header-content {
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0;
    }
    
    .header-content {
        padding: 0 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .logo-section {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .logo-text h1 {
        font-size: 1.25rem;
    }
    
    .logo-text p {
        display: none; /* Keep tagline hidden on mobile */
    }
    
    .theme-toggle {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .search-section {
        margin-bottom: 1.5rem;
    }
    
    .search-container {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    .search-input-group {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .search-icon {
        font-size: 0.9rem;
    }
    
    .search-input {
        padding: 0.75rem 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-button {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        min-width: auto;
    }
    
    .search-button span {
        display: none; /* Hide text on mobile, show only icon */
    }
    
    .repo-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .repo-header {
        margin-bottom: 1rem;
    }
    
    .repo-title {
        font-size: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .repo-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .repo-meta {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .meta-item {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .repo-stats {
        flex-direction: row;
        justify-content: space-between;
        margin-bottom: 1rem;
    }
    
    .stat-item {
        flex: 1;
        justify-content: center;
        padding: 0.625rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .repo-topics {
        margin-bottom: 1rem;
    }
    
    .topic-tag {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .repo-languages {
        margin-bottom: 1rem;
    }
    
    .language-tag {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .repo-dates {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .date-item {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }
    
    .repo-link {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
        word-break: break-all;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0;
    }
    
    .header-content {
        padding: 0 0.75rem;
    }
    
    .logo-section {
        gap: 0.375rem;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }
    
    .logo-text h1 {
        font-size: 1.125rem;
}

.theme-toggle {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .search-section {
        margin-bottom: 1rem;
    }
    
    .search-container {
        padding: 0.75rem;
        border-radius: var(--radius-sm);
    }
    
    .search-input-group {
        gap: 0.375rem;
    }
    
    .search-icon {
        font-size: 0.8rem;
    }
    
    .search-input {
        padding: 0.625rem 0.75rem;
        font-size: 16px;
    }
    
    .search-button {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .repo-card {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }
    
    .repo-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .repo-title i {
        font-size: 1rem;
    }
    
    .repo-description {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    
    .meta-item {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .meta-item i {
        font-size: 0.875rem;
    }
    
    .repo-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .stat-item i {
        font-size: 0.875rem;
    }
    
    .topic-tag,
    .language-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.375rem;
    }
    
    .date-item {
        font-size: 0.75rem;
    }
    
    .repo-link {
        font-size: 0.75rem;
        padding: 0.25rem 0.375rem;
        line-height: 1.4;
    }
    
    .footer {
        padding: 1rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .header {
        padding: 0.375rem 0;
    }
    
    .header-content {
        padding: 0 0.5rem;
    }
    
    .logo-section {
        gap: 0.25rem;
    }
    
    .logo-icon {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    
    .logo-text h1 {
        font-size: 1rem;
    }
    
    .theme-toggle {
        padding: 0.25rem;
        font-size: 0.75rem;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .search-container {
        padding: 0.5rem;
    }
    
    .search-input-group {
        gap: 0.25rem;
    }
    
    .search-input {
        padding: 0.5rem 0.625rem;
        font-size: 16px;
    }
    
    .search-button {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .search-button,
    .theme-toggle,
    .repo-link {
        min-height: 44px; /* iOS recommended touch target */
    }
    
    .search-button {
        padding: 1rem 1.5rem;
    }
    
    .theme-toggle {
        padding: 0.75rem;
    }
    
    .repo-card:hover {
        transform: none; /* Disable hover transforms on touch devices */
    }
    
    .search-button:hover,
    .theme-toggle:hover {
        transform: none;
    }
    
    .repo-link:hover {
        transform: none;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 0.5rem 0;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 0.75rem 1rem;
    }
    
    .search-section {
        margin-bottom: 1rem;
    }
    
    .search-container {
        padding: 0.75rem;
    }
    
    .search-input-group {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .search-button {
        min-width: 100px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1rem;
}