/**
 * Local360 Tools - Design System System
 * Inspired by Vercel, Stripe, and Apple design principles.
 * Focuses on high whitespace, subtle borders, crisp borders, and premium typography.
 */

:root {
    /* Font family */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Layout Tokens */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Light Mode Tokens */
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --card-foreground: #09090b;
    --popover: #ffffff;
    --popover-foreground: #09090b;
    --primary: #e11d48; /* Premium Rose-Crimson */
    --primary-foreground: #f8fafc;
    --secondary: #f4f4f5;
    --secondary-foreground: #18181b;
    --accent: #f59e0b; /* Yellow/Amber Accent */
    --accent-foreground: #78350f;
    --muted: #f4f4f5;
    --muted-foreground: #52525b;
    --border: #d4d4d8;
    --input: #d4d4d8;
    --ring: #e11d48;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.03), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

/* Dark Mode Tokens */
[data-theme="dark"] {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #121215;
    --card-foreground: #fafafa;
    --popover: #121215;
    --popover-foreground: #fafafa;
    --primary: #fb7185; /* Premium Rose-Crimson (Dark) */
    --primary-foreground: #ffffff;
    --secondary: #18181b;
    --secondary-foreground: #fafafa;
    --accent: #f59e0b;
    --accent-foreground: #fef3c7;
    --muted: #18181b;
    --muted-foreground: #a1a1aa;
    --border: #3f3f46;
    --input: #3f3f46;
    --ring: #fb7185;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Base Styles & Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
    color: inherit;
    text-decoration: none;
}

/* Reusable Design Tokens & Utilities */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

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

/* Premium Cards */
.premium-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    box-shadow: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.premium-card.interactive:hover,
.tool-card:hover {
    border-color: var(--ring);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Interactive Input Elements */
.input-group {
    margin-bottom: 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
}

.input-field {
    width: 100%;
    font-family: inherit;
    font-size: 0.8125rem;
    padding: 0.4rem 0.625rem;
    border-radius: var(--radius-sm);
    background-color: var(--card);
    border: 1px solid var(--border);
    color: var(--foreground);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-field:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15);
}
[data-theme="dark"] .input-field:focus {
    box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.2);
}

/* Custom Select Field */
.select-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2371717a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

/* Toggle Switches */
.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}
.toggle-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: var(--transition-fast);
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}
.toggle-input:checked + .toggle-slider {
    background-color: var(--primary);
}
.toggle-input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    gap: 0.5rem;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
    outline: none;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}
.btn-primary:hover {
    opacity: 0.92;
}
.btn-primary:focus {
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.25);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background-color: var(--border);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Dropzone (Drag and drop container) */
.dropzone-container {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background-color: var(--card);
    padding: 1.5rem 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.dropzone-container:hover, .dropzone-container.dragover {
    border-color: var(--ring);
    background-color: rgba(225, 29, 72, 0.02);
}
[data-theme="dark"] .dropzone-container:hover, [data-theme="dark"] .dropzone-container.dragover {
    background-color: rgba(251, 113, 133, 0.02);
}
.dropzone-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--muted-foreground);
}
.dropzone-prompt {
    font-size: 0.95rem;
    font-weight: 500;
}
.dropzone-file-info {
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

/* Progress bar container */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}
.progress-bar-fill {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 150ms linear;
}

/* Result panel spacing */
.result-container {
    background-color: var(--secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}
.result-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Loading animations */
.spinner {
    animation: rotate 1s linear infinite;
    width: 1.25rem;
    height: 1.25rem;
}
.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}
@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

.animate-fade-in {
    animation: fadeIn 300ms ease-out forwards;
}
.animate-slide-up {
    animation: slideUp 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Webkit Scrollbars matching Light & Dark themes */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 9999px;
    border: 2px solid var(--background);
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--muted-foreground);
}
