/**
 * Image Cropper - Unified Dark Premium Theme
 * Matching Web-Tools homepage and Image Converter aesthetic
 */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap");

/* ============================================
   CSS Variables (matching homepage)
   ============================================ */
:root {
    --bg-dark: #0a0a0a;
    --wood-black: #121212;
    --wood-gray: #2c2c2c;
    --accent-glow: rgba(255, 255, 255, 0.05);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --card-bg: rgba(30, 30, 30, 0.6);
    --transition-speed: 0.4s;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: "Outfit", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background-color: var(--bg-dark);
    background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

/* Wood Grain Effect Overlay */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    ),
    linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
    opacity: 0.4;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================
   Container - Glassmorphism Card
   ============================================ */
.container {
    width: 100%;
    max-width: 1000px;
    animation: fadeInUp 0.8s ease-out forwards;
}

/* ============================================
   Back Navigation
   ============================================ */
.back-nav {
    margin-bottom: 2rem;
}

.back-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.back-nav a:hover {
    color: white;
}

/* ============================================
   Header
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: -1px;
    background: linear-gradient(to bottom, #ffffff, #888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ============================================
   Drop Zone
   ============================================ */
.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    background: rgba(40, 40, 40, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    min-height: 280px;
    backdrop-filter: blur(10px);
}

.drop-zone:hover,
.drop-zone--active {
    background: rgba(60, 60, 60, 0.6);
    border-color: var(--text-secondary);
    transform: scale(1.01);
}

.drop-zone__icon {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}

.drop-zone:hover .drop-zone__icon {
    color: white;
    transform: scale(1.1);
}

.drop-zone__text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-zone__text kbd {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-family: inherit;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: white;
    margin: 0 0.15rem;
}

.drop-zone__hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.drop-zone--hidden {
    display: none;
}

/* ============================================
   Editor Container
   ============================================ */
.editor-container {
    display: none;
}

.editor-container--visible {
    display: block;
    animation: popIn 0.4s ease;
}

/* ============================================
   Editor Layout (Cropper + Preview)
   ============================================ */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.cropper-wrapper {
    width: 100%;
    min-height: 300px;
    max-height: 500px;
    background: var(--wood-black);
    border-radius: 16px;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cropper-wrapper img {
    display: block;
    max-width: 100%;
}

/* ============================================
   Live Preview Panel
   ============================================ */
.preview-panel {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.preview-panel__title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    text-align: center;
}

.preview-container {
    width: 100%;
    height: 180px;
    background: var(--wood-black);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-panel__hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 1rem;
    line-height: 1.5;
}

/* ============================================
   Cropper.js Theme Overrides
   ============================================ */
.cropper-container {
    border-radius: 16px;
}

.cropper-view-box {
    outline: 2px solid rgba(255, 255, 255, 0.8);
}

.cropper-line {
    background-color: rgba(255, 255, 255, 0.5);
}

.cropper-point {
    background-color: white;
    width: 10px;
    height: 10px;
    opacity: 0.9;
}

.cropper-point.point-se {
    width: 12px;
    height: 12px;
}

.cropper-dashed {
    border-color: rgba(255, 255, 255, 0.35);
}

.cropper-modal {
    background-color: rgba(10, 10, 10, 0.75);
}

/* ============================================
   Controls
   ============================================ */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* Base Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Secondary Button (Icon buttons) */
.btn--secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    min-width: 48px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

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

/* Primary Button (Download) */
.btn--primary {
    background: white;
    color: black;
    font-weight: 600;
    padding: 0.85rem 1.75rem;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.btn--primary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.15);
}

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

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .title {
        font-size: 2rem;
    }

    .drop-zone {
        padding: 3rem 1.5rem;
        min-height: 220px;
        border-radius: 16px;
    }

    .drop-zone__icon svg {
        width: 48px;
        height: 48px;
    }

    .editor-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .cropper-wrapper {
        min-height: 200px;
        max-height: 350px;
    }

    .preview-panel {
        order: -1;
    }

    .preview-container {
        height: 120px;
    }

    .controls {
        gap: 0.5rem;
        padding: 1rem;
    }

    .btn--secondary {
        min-width: 42px;
        padding: 0.65rem;
    }

    .btn--primary {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
}

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