/* Global design system for FileNest
   - Typography, layout, and theming
   - Shared components (buttons, loaders, overlays)
   - Utility classes
*/
body {
   -webkit-tap-highlight-color: transparent;
}

:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --anim-speed: 0.3s;
}

:root.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --hover-bg: #2a2a2a;
    --card-bg: #252525;
    --card-hover-bg: #333333;
    --input-bg: #252525;
    --focus-outline: #ffffff;
    --accent-color: #4caf50;
    --btn-bg: #333333;
    --btn-text: #ffffff;
    --btn-border: #555555;
}

:root.light-mode {
    --bg-color: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --hover-bg: #f8f9fa;
    --card-bg: #ffffff;
    --card-hover-bg: #f8f9fa;
    --input-bg: #f8f9fa;
    --focus-outline: #000000;
    --accent-color: #198754;
    --btn-bg: #ffffff;
    --btn-text: #212529;
    --btn-border: #dee2e6;
}

:root.colorful-mode {
    --bg-color: #f0f4f8;
    --text-color: #1a202c;
    --text-muted: #718096;
    --border-color: #cbd5e0;
    --hover-bg: #e2e8f0;
    --card-bg: #ffffff;
    --card-hover-bg: #f7fafc;
    --input-bg: #ffffff;
    --focus-outline: #4299e1;
    --accent-color: #dd6b20;
    --btn-bg: #2d3748;
    --btn-text: #ffffff;
    --btn-border: #2d3748;
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline;
}

.tool-card {
    color: var(--text-color) !important;
    text-decoration: none !important;
}

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color var(--anim-speed), color var(--anim-speed);
}

/* Shared UI polish */
.btn,
.card,
.page-card,
.image-card,
.file-item,
.drop-zone,
input,
select,
textarea,
.tool-card {
    border-radius: 5px !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn:hover,
.card:hover,
.image-card:hover,
.page-card:hover {
    transform: none;
    box-shadow: none;
    background: var(--hover-bg);
}

.btn:active {
    transform: scale(0.98);
}

/* Global Loader */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

/* Spinner Animation */
.spinner,
#global-loader .material-icons {
    font-size: 0 !important;
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

.loader-progress {
    width: 200px;
    height: 4px;
    background: var(--border-color);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.loader-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: var(--accent-color);
    animation: indeterminate 1.5s infinite ease-in-out;
    box-shadow: 0 0 10px var(--accent-color);
}

@keyframes indeterminate {
    0% {
        left: -40%;
    }
    100% {
        left: 100%;
    }
}

/* Fade In */
.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography & Layout */
header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-color);
    text-decoration: none;
}

main {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--text-color);
    color: var(--bg-color);
    border: 1px solid var(--text-color);
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 0.5rem;
}

button.btn,
a.btn {
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    min-height: 42px;
    padding-inline: 1.1rem;
    padding-block: 0.65rem;
    line-height: 1;
}

button.btn,
a.btn,
button.btn-text,
a.btn-text,
button.btn-small,
a.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button.btn .material-icons,
a.btn .material-icons,
button.btn-text .material-icons,
a.btn-text .material-icons,
button.btn-small .material-icons,
a.btn-small .material-icons {
    font-size: 1.1em;
    line-height: 1;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-color);
}

button.btn-outline,
a.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--hover-bg);
}

.btn-danger {
    background-color: #d32f2f !important;
    color: #ffffff !important;
    border-color: #d32f2f !important;
}

.btn-danger:hover {
    background-color: #c62828 !important;
    border-color: #c62828 !important;
}

.btn-success {
    background-color: #28a745 !important;
    color: #ffffff !important;
    border: none !important;
}

.btn-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border: none !important;
}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 4px;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Global progress overlay */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.progress-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.progress-message {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.2rem;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-color);
    transition: width 0.2s ease;
}

.progress-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Offline warning bar */
.offline-warning-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #d32f2f;
    color: #ffffff;
    text-align: center;
    padding: 12px 0;
    z-index: 10000;
    font-weight: 500;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

/* Privacy badge */
.privacy-badge {
    margin-top: 15px;
    color: #2e7d32;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
    pointer-events: none;
    font-family: inherit;
}

.privacy-badge .material-icons {
    font-size: 16px;
}

/* Top loader */
#filenest-top-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#filenest-top-loader .bar {
    background: #2ea44f;
    width: 0;
    height: 100%;
    box-shadow: 0 0 10px rgba(46, 164, 79, 0.7);
    transition: width 0.2s ease;
}

.is-hidden {
    display: none !important;
}

/* Utility helpers */
.text-muted {
    color: var(--text-muted) !important;
}

.text-danger {
    color: #ff4444 !important;
}

.text-accent {
    color: var(--accent-color) !important;
}

.btn-text-danger {
    color: #ff4444 !important;
}

.icon-lg {
    font-size: 1.2rem;
}

.icon-2xl {
    font-size: 2rem;
}

.icon-3xl {
    font-size: 3rem;
}

.icon-4xl {
    font-size: 4rem;
}

.drop-zone-icon {
    font-size: 3rem;
    color: var(--text-muted);
}

/* --- Modern UX enhancements (Google / Apple inspired) --- */

:root {
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.18);
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1.25rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
}

body {
    background: radial-gradient(circle at top, rgba(148, 163, 184, 0.15), transparent 60%) var(--bg-color);
    background-attachment: fixed;
}

/* Layout */

header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 1rem 2.25rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dark-mode header {
    background: rgba(26, 26, 26, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.logo span.logogrey {
    font-weight: 500;
    opacity: 0.7;
}

header nav,
header .header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header .nav-link,
header .btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.18s ease-out;
}

header .nav-link:hover,
header .btn-icon:hover {
    color: var(--text-color);
    border-color: rgba(148, 163, 184, 0.6);
    background: rgba(148, 163, 184, 0.08);
    text-decoration: none;
}

main {
    max-width: 1120px;
    padding-inline: 1.5rem;
    padding-block: 3.5rem 4rem;
}

section,
.tool-container {
    margin-bottom: var(--space-xl);
}

.card,
.settings-card,
.tool-container,
.donate-card,
.compression-card {
    padding: 2rem;
}

/* Typography */

h1,
h2,
h3,
h4 {
    font-family: var(--font-main);
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.1rem, 3vw, 2.7rem);
    font-weight: 700;
}

h2 {
    font-size: clamp(1.4rem, 2.2vw, 1.7rem);
    font-weight: 600;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

p {
    font-size: 0.98rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Cards / Surfaces */

.card,
.settings-card,
.tool-container,
.donate-card,
.compression-card {
    border-radius: 24px !important;
    border: 1px solid rgba(0,0,0,0.05);
    background: var(--card-bg);
}

.dark-mode .card,
.dark-mode .settings-card,
.dark-mode .tool-container,
.dark-mode .donate-card,
.dark-mode .compression-card {
    border: 1px solid rgba(255,255,255,0.05);
}

.tool-card {
    border-radius: 28px !important;
    border: 1px solid rgba(0,0,0,0.05);
    background: var(--card-bg);
    transition: background-color 0.3s;
}

.dark-mode .tool-card {
    border: 1px solid rgba(255,255,255,0.05);
}

.tool-card:hover {
    background: var(--hover-bg);
    transform: none;
    box-shadow: none;
}

.tool-card .material-icons {
    border-radius: 999px;
    padding: 0.4rem;
    background: rgba(15, 118, 110, 0.08);
}

/* Buttons */

.btn {
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    min-height: 42px;
    padding-inline: 1.1rem;
    padding-block: 0.65rem;
    border: 1px solid var(--text-color);
    line-height: 1;
}

.btn:hover {
    opacity: 1;
    background: var(--hover-bg);
    transform: none;
}

.btn:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 3px;
}

.btn[disabled],
button[disabled] {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--hover-bg);
    border-color: var(--text-color);
}

button.btn-text,
a.btn-text {
    min-height: 36px;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    text-decoration: none !important;
    color: var(--text-muted);
    border: 1px solid transparent;
    background: transparent;
}

button.btn-text:hover,
a.btn-text:hover {
    color: var(--text-color);
    background: var(--hover-bg);
    border-color: var(--border-color);
}

button.btn-small,
a.btn-small {
    min-height: 34px;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
}

button.btn,
a.btn,
button.btn-outline,
a.btn-outline,
button.btn-success,
a.btn-success,
button.btn-danger,
a.btn-danger,
button.btn-secondary,
a.btn-secondary,
button.btn-text,
a.btn-text,
button.btn-small,
a.btn-small {
    border-radius: 999px !important;
}

button.btn:not(.btn-large),
a.btn:not(.btn-large),
button.btn-outline,
a.btn-outline,
button.btn-success,
a.btn-success,
button.btn-danger,
a.btn-danger,
button.btn-secondary,
a.btn-secondary {
    min-height: 42px !important;
    padding: 0.68rem 1.15rem !important;
    gap: 0.5rem !important;
    line-height: 1.1 !important;
    align-items: center !important;
    justify-content: center !important;
}

button.btn-text,
a.btn-text,
button.btn-small,
a.btn-small {
    gap: 0.45rem !important;
    line-height: 1.1 !important;
    align-items: center !important;
    justify-content: center !important;
}

button.btn .material-icons,
a.btn .material-icons,
button.btn-outline .material-icons,
a.btn-outline .material-icons,
button.btn-success .material-icons,
a.btn-success .material-icons,
button.btn-danger .material-icons,
a.btn-danger .material-icons,
button.btn-secondary .material-icons,
a.btn-secondary .material-icons,
button.btn-text .material-icons,
a.btn-text .material-icons,
button.btn-small .material-icons,
a.btn-small .material-icons {
    font-size: 1.1em !important;
    line-height: 1 !important;
    vertical-align: middle;
}

button.btn-small:hover,
a.btn-small:hover {
    background: var(--hover-bg);
}

/* Hero-specific large button */
.btn.btn-large {
    font-size: 1rem;
    padding-block: 0.9rem;
    padding-inline: 2.2rem;
}

/* Inputs / form controls */

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.02);
    border-color: rgba(148, 163, 184, 0.6);
}

input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.9);
}

/* Drop zones & lists */

.drop-zone {
    border-radius: 28px !important;
    border: 1px dashed var(--border-color);
    background: var(--input-bg);
    padding: 3rem 2.25rem;
}

.light-mode .drop-zone,
:root.light-mode .drop-zone,
:root.colorful-mode .drop-zone {
    background: #f9fafb;
}

.drop-zone.drag-over {
    border-color: var(--accent-color);
    transform: none;
    box-shadow: none;
}

.drop-zone .btn,
.drop-zone .btn-outline,
.drop-zone button {
    margin-top: 0.8rem;
}

.file-item,
.image-item {
    border-radius: var(--radius-md) !important;
    border-color: rgba(148, 163, 184, 0.3);
    background: linear-gradient(
        to right,
        rgba(148, 163, 184, 0.16),
        rgba(15, 23, 42, 0.08)
    );
}

.image-thumb {
    border-radius: var(--radius-sm);
}

/* Toasts & toasts in tools_home/settings */

.toast,
.settings-toast {
    border-radius: 999px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.45);
}

.settings-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Settings save bar */

#settings-save-bar {
    box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.45);
    border-radius: 16px 16px 0 0;
    backdrop-filter: blur(16px);
}

/* Animations */

@keyframes cardFloat {
    0% {
        transform: translateY(0);
        box-shadow: 0 14px 35px rgba(15, 23, 42, 0.16);
    }
    50% {
        transform: translateY(-4px);
        box-shadow: 0 22px 60px rgba(15, 23, 42, 0.26);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 14px 35px rgba(15, 23, 42, 0.16);
    }
}

.hero-visual .floating-icon {
    animation-duration: 7.2s;
    animation-timing-function: ease-in-out;
}



/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Mobile refinements */
@media (max-width: 768px) {
    header {
        padding-inline: 1.1rem;
    }

    main {
        padding-inline: 1.1rem;
        padding-block: 1.75rem 2.5rem;
    }

    .btn,
    button {
        box-sizing: border-box;
        display: flex;
        width: 100%;
        max-width: 100%;
        white-space: normal;
        word-break: break-word;
        padding: 0.7rem 1.1rem;
        justify-content: center;
    }

    .btn + .btn,
    button {
        margin-top: 0.6rem;
    }
}


