/* ============================================
    CONVERT WEB APP - GLOBAL STYLES
    ============================================ */

/* CSS Variables & Theme System */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --glass-light: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

html.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --glass-light: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   GLASSMORPHISM COMPONENTS
   ============================================ */

.glass {
    background: var(--glass-light);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.glass-strong {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ============================================
   BUTTONS & LINKS
   ============================================ */

button, a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:active, a:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--glass-light);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */

.tool-card {
    position: relative;
    overflow: hidden;
    group: contents;
    cursor: pointer;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}

.tool-card:hover::before {
    left: 100%;
}

.tool-card-body {
    padding: 18px;
    position: relative;
    z-index: 1;
}

.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ============================================
   HEADER LAYOUT
   ============================================ */

.header-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.header-back-link {
    justify-self: start;
    white-space: nowrap;
}

.back-link-short {
    display: none;
}

.header-brand {
    justify-self: center;
}

.header-actions {
    justify-self: end;
}

@media (max-width: 900px) {
    .header-layout {
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .header-back-link {
        justify-self: start;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 12px;
    }

    .header-brand {
        justify-self: center;
        min-width: 0;
    }

    .header-brand h1 {
        font-size: 1rem;
        line-height: 1.1;
    }

    .header-brand p {
        font-size: 0.72rem;
    }

    .header-actions {
        justify-self: end;
        justify-content: flex-end;
        gap: 8px;
    }

    .header-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 9999px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
    }

    .header-icon-btn span {
        font-size: 16px;
        line-height: 1;
    }

    .header-filter-btn {
        display: none;
    }
}

@media (max-width: 520px) {
    .back-link-full {
        display: none;
    }

    .back-link-short {
        display: inline;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideDownIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }
.fade-in-delay-4 { animation-delay: 0.4s; }

.animate-slide-up {
    animation: fadeInUp 0.3s ease-out;
}

.animate-pulse-glow {
    animation: pulse-glow 2s infinite;
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   FORMS & INPUTS
   ============================================ */

input, textarea, select {
    background: var(--glass-light);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.3s ease;
}

input::placeholder, textarea::placeholder {
    color: var(--text-tertiary);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .tool-card-body {
        padding: 16px;
    }

    header {
        padding: 12px 16px !important;
    }

    main {
        padding: 16px !important;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-lg {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.shadow-xl {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

/* Line Clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .glass, header, footer, .glass:hover {
        background: transparent;
        border: 1px solid #ccc;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-color-scheme: light) {
    html {
        color-scheme: light;
    }
}

@media (prefers-color-scheme: dark) {
    html {
        color-scheme: dark;
    }
}
