/* Shared CSS for WCS Tools Hub */

/* CSS Variables for theming */
:root {
    --primary-green: #16a34a;
    --primary-green-dark: #15803d;
    --primary-green-light: #22c55e;
    --background: #ffffff;
    --surface: #f8fafc;
    --surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --error: #dc2626;
    --success: #16a34a;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --transition: all 0.2s ease;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --surface-hover: #334155;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --border: #334155;
    }
}

/* Dark mode override */
body.dark-mode {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border: #334155;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Header */
.header {
    background-color: var(--primary-green);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

/* Hamburger menu button */
.hamburger-button {
    width: 2rem;
    height: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.hamburger-button span {
    display: block;
    width: 1.5rem;
    height: 2px;
    background: white;
    transition: var(--transition);
}

/* Navigation menu */
.nav-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.nav-menu.active {
    transform: translateX(280px);
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.nav-overlay.active {
    display: block;
}

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

.nav-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-primary);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-list {
    flex: 1;
    list-style: none;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--surface-hover);
}

.nav-link.active {
    background: var(--primary-green);
    color: white;
}

.nav-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* Theme toggle in menu */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

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

/* Toggle switches */
.toggle-switch {
    position: relative;
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 9999px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.125rem;
    width: 1.125rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-green);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(1.5rem);
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.message-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.message-error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.message-with-button {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.message-ok-button {
    align-self: flex-end;
    padding: 0.5rem 1.5rem;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.message-ok-button:hover {
    background: var(--primary-green-dark);
}

/* Buttons */
.button {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.button-primary:hover:not(:disabled) {
    background: var(--primary-green-dark);
}

.button-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.button-secondary:hover {
    background: var(--surface-hover);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Back button */
.back-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    transition: var(--transition);
}

.back-button:hover {
    opacity: 0.8;
}

/* Page transitions */
.page-enter {
    opacity: 0;
    transform: translateX(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s, transform 0.3s;
}

.page-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s, transform 0.3s;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .header {
        padding: 0.75rem;
    }

    .header-title {
        font-size: 1.125rem;
    }

    .main {
        padding: 0.75rem;
    }
}

/* Utility classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}