/* ==========================================
   IMAGIKS - Global Design System & Stylesheet
   ========================================== */

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    padding-bottom: 5rem;
}

/* Glassmorphism Effect */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding: 1rem 2rem;
    background-color: #000000;
    border-radius: 12px;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.main-nav a {
    text-decoration: none;
    color: #f8fafc;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
}

.main-nav a:hover {
    color: var(--primary);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #000000;
    min-width: 220px;
    box-shadow: 0px 15px 30px rgba(0,0,0,0.5);
    z-index: 1000;
    border-radius: 12px;
    padding: 0.75rem 0;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: #f8fafc;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    text-align: left;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    padding-left: 1.75rem;
}

.dropdown > a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.dropdown > a i.fa-chevron-down {
    font-size: 0.7rem;
    transition: var(--transition);
}

.dropdown:hover > a i.fa-chevron-down {
    transform: rotate(180deg);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #ffffff;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.theme-toggle {
    cursor: pointer;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border-radius: 50%;
    transition: var(--transition);
    color: #ffffff;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #ffffff;
    transition: var(--transition);
}

/* Upload Section */
.upload-zone {
    padding: 3.5rem 2rem;
    text-align: center;
    border: 2px dashed var(--border);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

#file-input {
    display: none;
}

/* Main Content Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .main-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Preview Grid */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.image-card {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.image-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.card-info {
    padding: 0.75rem;
}

.card-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.image-card:hover .remove-btn {
    opacity: 1;
}

/* Tools Panel */
.tools-panel {
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 1.5rem;
}

.tools-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.tools-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tool-content {
    display: none;
}

.tool-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.input-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

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

.slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-outline {
    padding: 0.6rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#process-btn {
    background: linear-gradient(135deg, #6b21a8, #0ea5e9);
    box-shadow: 0 4px 15px rgba(107, 33, 168, 0.4);
    border: none;
}

#process-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #581c87, #0284c7);
    box-shadow: 0 6px 20px rgba(107, 33, 168, 0.6);
}

/* Output Section */
.output-section {
    margin-top: 3rem;
    display: none;
}

.output-card {
    padding: 2rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Crop Overlay */
#crop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.crop-container {
    max-width: 80vw;
    max-height: 70vh;
    background: #1e293b;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

#crop-canvas {
    display: block;
    cursor: crosshair;
    max-width: 100%;
    max-height: 100%;
}

.crop-toolbar {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Live Preview Section */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.comparison-box {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    text-align: center;
}

.comparison-box img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
}

.comparison-label {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.comparison-size {
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.result-item {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .result-item {
        grid-template-columns: 1fr 2fr;
        align-items: center;
    }
}

.result-info h4 {
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.card-actions {
    position: absolute;
    bottom: 3.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition);
}

.image-card:hover .card-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
    transform: scale(1.1);
    background: var(--primary);
}

/* SEO & Hero Content Styling */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.seo-hero {
    text-align: center;
    padding: 2.5rem 1.5rem;
    margin-bottom: 2rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.seo-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #8b5cf6, var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.seo-hero p {
    max-width: 900px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1.8;
}

.seo-section {
    margin-top: 4rem;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.seo-section h2 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
    color: var(--primary);
}

.seo-section h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.seo-section p,
.seo-section li {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.seo-section ul,
.seo-section ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.section-header .underline {
    width: 80px;
    height: 4px;
    background: var(--primary);
    margin: 0 auto;
    border-radius: 2px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
    margin-bottom: 5rem;
}

.feature-card {
    padding: 2.5rem;
    transition: var(--transition);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--card-bg);
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: inline-block;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.why-choose-us {
    padding: 4rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(16, 185, 129, 0.05));
    border: 1px solid var(--border);
    margin-bottom: 6rem;
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.why-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    font-weight: 500;
    font-size: 1.1rem;
}

.why-item i {
    color: var(--secondary);
    font-size: 1.25rem;
    margin-top: 0.2rem;
}

.faq-section {
    max-width: 1000px;
    margin: 0 auto 6rem;
}

.faq-grid {
    display: grid;
    gap: 1.5rem;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item summary {
    padding: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.faq-item[open] summary::after {
    transform: rotate(180deg);
}

.faq-item[open] {
    border-color: var(--primary);
}

.faq-content {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1rem;
}

.cta-footer {
    text-align: center;
    padding: 5rem 2rem;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: white;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.cta-footer h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.cta-footer p {
    opacity: 0.8;
}

.btn-white {
    display: inline-block !important;
    padding: 1rem 2.5rem !important;
    background: #ffffff !important;
    color: #0f172a !important;
    text-decoration: none !important;
    border-radius: var(--radius-md) !important;
    font-weight: 700 !important;
    transition: var(--transition) !important;
    margin-top: 2rem !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2) !important;
    cursor: pointer !important;
}

.btn-white:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.3) !important;
    background: #f1f5f9 !important;
}

/* Info Pages & Generic Content Styling */
.page-content {
    padding: 3rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.page-content h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.page-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.page-content ul {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    font-size: 1.1rem;
}

.page-content li {
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    display: block;
}

.alert-box {
    padding: 1.5rem;
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    margin-bottom: 2rem;
    border-radius: 0 8px 8px 0;
}

.alert-box strong {
    color: #ef4444;
}

/* Contact Page Specific Grid */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

.contact-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.contact-info p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.info-card {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid var(--primary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.info-card i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-top: 0.2rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.btn-submit {
    padding: 1rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    header {
        position: relative;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.75rem 1.5rem !important;
        margin-bottom: 1.5rem;
    }

    .logo img {
        height: 50px !important;
    }

    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #000000;
        padding: 1.5rem;
        gap: 1.25rem;
        z-index: 1000;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.6);
        text-align: center;
    }

    .main-nav.active {
        display: flex;
    }

    .main-nav a {
        font-size: 1.1rem;
        padding: 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-nav a:last-child {
        border-bottom: none;
    }

    /* Mobile Dropdown Styling */
    .dropdown {
        display: block;
        width: 100%;
    }

    .dropdown-content {
        position: static;
        transform: none;
        display: none;
        background: rgba(255, 255, 255, 0.1);
        box-shadow: none;
        border: none;
        padding: 0;
        margin-top: 0.5rem;
        width: 100%;
        border-radius: 8px;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    .dropdown-content a {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding: 0.75rem !important;
    }

    .dropdown > a {
        justify-content: center;
        padding: 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .seo-hero {
        padding: 1.25rem 0.75rem;
        margin-bottom: 1rem;
    }

    .seo-hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.4rem;
    }

    .seo-hero p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .upload-zone {
        padding: 2.5rem 1rem;
    }

    .tools-panel {
        position: static;
    }

    .tools-tabs {
        padding-bottom: 0.75rem;
    }

    .btn-primary {
        position: sticky;
        bottom: 1rem;
        z-index: 100;
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}
