/* General Styles */
:root {
    --background-light: #0C162D; /* Midnight Navy */
    --background-dark: #0C162D; /* Midnight Navy */
    --card-light: rgba(255, 255, 255, 0.1); /* Transparent white for light mode */
    --card-dark: rgba(12, 22, 45, 0.9); /* Midnight Navy with transparency */
    --text-light: #FFFFFF; /* Soft White */
    --text-dark: #FFFFFF; /* Soft White */
    --primary: #00CFFF; /* Electric Blue */
    --primary-hover: #00A8CC; /* Darker Electric Blue */
    --success: #6DFF5C; /* Neon Green */
    --success-hover: #4CDD3C; /* Darker Neon Green */
    --danger: #FF4C4C; /* Red for errors */
    --danger-hover: #CC3C3C; /* Darker Red */
    --warning: #FFC107; /* Yellow for warnings */
    --title-color: #81D8D0; /* Coral title color */
    --title-hover: #CEF1F0; /* Lighter coral on hover */
    --gradient: linear-gradient(135deg, #6DFF5C 0%, #00CFFF 100%); /* Neon Green to Electric Blue */
    --zipper-silver: #C0C0C0; /* Zipper Silver */
    --shadow-gray: #333333; /* Shadow Gray */
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-light);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--background-dark);
        color: var(--text-dark);
    }
}

h1 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Scales with viewport width so the title always fits on one line,
       instead of relying on fixed breakpoints that can still wrap. */
    font-size: clamp(1.15rem, 5.5vw, 2.2rem);
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    transition: var(--transition);
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
}

.brand-name {
    font-size: 1em;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--title-color); /* fallback if background-clip:text isn't supported */
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.brand-tagline {
    font-size: 0.32em;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--zipper-silver);
    margin-top: 0.2em;
}

h1:hover .brand-name {
    filter: brightness(1.15);
}

.converter {
    background: var(--card-light);
    padding: 30px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 95%;
    text-align: center;
    transition: var(--transition);
    border: 2px solid var(--zipper-silver);
    margin: 30px 0;
    position: relative;
    overflow: hidden;
}

.converter::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0,207,255,0.1) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    z-index: -1;
}

@media (prefers-color-scheme: dark) {
    .converter {
        background: var(--card-dark);
    }
}

/* Responsive Design Adjustments */
@media (max-width: 768px) {
    .converter {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .converter {
        padding: 20px;
    }
}

/* File Input Styling */
.file-input {
    margin: 20px 0;
    position: relative;
}

.file-input input[type="file"] {
    display: none;
}

.file-input label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    color: var(--text-light);
    padding: 14px 28px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.file-input label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4CDD3C 0%, #00A8CC 100%);
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.file-input label:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.file-input label:hover::before {
    opacity: 1;
}

.file-input label:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 207, 255, 0.4);
}

.file-name {
    margin-top: 12px;
    font-size: 14px;
    color: var(--zipper-silver);
    font-weight: 500;
}

/* Selected Files List (multi-file upload, with per-file remove) */
.selected-files-list {
    display: none;
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    max-height: 160px;
    overflow-y: auto;
    text-align: left;
}

.selected-files-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-light);
}

.selected-files-list .file-entry-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-files-list .remove-file-button {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.selected-files-list .remove-file-button:hover {
    color: var(--danger-hover);
    background: rgba(255, 76, 76, 0.15);
}

/* Quality note (e.g. for lossless formats where quality has no effect) */
.quality-note {
    color: var(--zipper-silver);
    font-weight: 400;
    font-size: 13px;
}

/* Drag-and-Drop Area */
.drag-drop-area {
    border: 2px dashed var(--primary);
    border-radius: var(--border-radius);
    padding: 30px 20px;
    margin: 20px 0;
    background: rgba(0, 207, 255, 0.05);
    transition: var(--transition);
    position: relative;
}

.drag-drop-area.dragover {
    border-color: var(--success);
    background: rgba(109, 255, 92, 0.1);
    transform: scale(1.02);
}

.drag-drop-area p {
    margin: 0 0 10px 0;
    color: var(--text-light);
    font-weight: 500;
}

/* Error Message Styling */
.error-message {
    color: var(--danger);
    margin-top: 10px;
    font-size: 14px;
    display: none;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(255, 76, 76, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--danger);
}

/* Warning Message Styling */
.warning-message {
    color: var(--warning);
    margin-top: 10px;
    font-size: 14px;
    display: none;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--warning);
}

/* Select Dropdown Styling */
.format-select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--zipper-silver);
    border-radius: var(--border-radius);
    margin: 20px 0;
    font-size: 16px;
    color: var(--text-light);
    background: var(--card-light);
    transition: var(--transition);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2300CFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    font-weight: 500;
}

.format-select:hover {
    border-color: var(--primary);
    background-color: rgba(0, 207, 255, 0.1);
}

.format-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 207, 255, 0.3);
}

.format-select option:disabled {
    color: var(--zipper-silver);
}

/* Quality Slider Styling */
.quality-slider {
    width: 100%;
    margin: 25px 0;
}

.quality-slider label {
    display: block;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text-light);
    font-weight: 500;
}

.quality-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quality-slider input[type="range"] {
    flex: 1;
    height: 8px;
    background: var(--zipper-silver);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.quality-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--background-light);
}

.quality-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.quality-slider input[type="range"]:focus {
    outline: none;
}

.quality-slider input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(0, 207, 255, 0.3);
}

.quality-slider input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.quality-slider input[type="range"]:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.quality-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    background: rgba(0, 207, 255, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
}

/* File Size Display */
.file-size {
    margin-top: 12px;
    font-size: 14px;
    color: var(--zipper-silver);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.file-size-icon {
    width: 16px;
    height: 16px;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    margin: 25px 0;
    display: none;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--zipper-silver);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--zipper-silver);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0;
    background: var(--gradient);
    border-radius: 5px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.3) 50%,
        rgba(255,255,255,0) 100%);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Image Preview Styling */
.preview-container {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: rgba(0, 0, 0, 0.1);
    border: 2px dashed var(--zipper-silver);
    border-radius: var(--border-radius);
    /* Cropper.js draws drag handles slightly outside the image bounds;
       clipping them with overflow:hidden would make corner dragging awkward. */
    overflow: visible;
    transition: border 0.3s ease;
    position: relative;
}

#preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    display: none;
    object-fit: contain;
}

/* Covers the preview/cropper completely while comparing, without
   disturbing the live Cropper.js instance underneath. */
.compare-overlay {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--background-light);
    border-radius: var(--border-radius);
    z-index: 5;
}

/* Section Labels (step headings: Upload / Preview & Crop / Output Settings) */
.section-label {
    margin: 28px 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    text-align: left;
}

.converter > .section-label:first-of-type {
    margin-top: 20px;
}

/* Numbered step badge (1-4) shown before each main section heading */
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient);
    color: var(--background-light);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Control Group: visible label + its select (previously screen-reader-only labels) */
.control-group {
    text-align: left;
    margin: 16px 0;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--zipper-silver);
}

.control-group .format-select {
    margin: 0;
}

/* Output Settings grid: format + resize side by side on wider screens */
.output-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .output-settings-grid {
        grid-template-columns: 1fr;
    }

    /* Stack presets one per row instead of letting them wrap into an
       uneven 2-then-1 layout on narrow screens. */
    .presets {
        flex-direction: column;
    }

    .preset-item {
        min-width: 100%;
    }

    /* Native <select> elements resist flex-shrink below their content's
       natural width in some browsers even with min-width:0 set, which was
       pushing "Reset Crop" out past the edge of the card instead of
       wrapping. Force a deterministic stacked layout here instead of
       relying on shrink behavior. */
    .crop-controls {
        flex-direction: column;
    }

    .crop-controls .format-select,
    .crop-controls .reset-crop-button {
        width: 100%;
        flex: 1 1 auto;
    }
}

/* Crop Controls */
.crop-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.crop-controls .format-select {
    margin: 0;
    /* Override the global .format-select { width: 100% }, which inside
       this flex row was claiming full width and pushing the reset button
       out of view instead of sharing space with it. */
    width: auto;
    flex: 1 1 200px;
    min-width: 0;
}

.reset-crop-button {
    flex: 0 0 auto;
    background: rgba(0, 207, 255, 0.1);
    color: var(--text-light);
    border: 1px solid var(--primary);
    font-size: 14px;
    padding: 0 18px;
    white-space: nowrap;
}

.reset-crop-button:hover {
    background: var(--primary);
}

.crop-hint {
    margin: -6px 0 10px;
    font-size: 13px;
    color: var(--zipper-silver);
    text-align: center;
}

.preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    font-size: 12px;
    display: none;
    text-align: center;
}

.placeholder-text {
    color: var(--zipper-silver);
    font-size: 14px;
    padding: 20px;
    text-align: center;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--primary);
    opacity: 0.7;
}

/* Download Link Styling */
.download-link {
    display: none;
    margin-top: 25px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

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

.download-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.download-list a,
.download-list button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    color: var(--text-light);
    padding: 14px 28px;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 1;
    width: 100%;
}

.download-list a::before,
.download-list button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4CDD3C 0%, #00A8CC 100%);
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.download-list a:hover,
.download-list button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.download-list a:hover::before,
.download-list button:hover::before {
    opacity: 1;
}

.download-list button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ZIP is the recommended action for multi-file batches: give it more
   visual weight than the plain per-file download links below it. */
.zip-download-button {
    background: var(--success) !important;
    color: var(--background-light) !important;
    border: 2px solid var(--success-hover);
}

.zip-download-button::before {
    background: var(--success-hover) !important;
}

/* Compare-with-original toggle: a quiet, secondary action - shouldn't
   compete visually with the actual download buttons. */
.download-list .compare-button {
    background: rgba(0, 207, 255, 0.1);
    color: var(--text-light);
    border: 1px solid var(--primary);
    font-weight: 500;
}

.download-list .compare-button:hover {
    background: var(--primary);
    transform: none;
}

.download-icon {
    margin-right: 8px;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

/* Button Base Styles */
.button-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex: 1;
}

.button-base:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 207, 255, 0.3);
}

.button-base:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.button-base::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.button-base:hover::after {
    width: 300px;
    height: 300px;
}

/* Convert Button Styling */
.convert-button {
    background: var(--gradient);
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.5px;
    /* Primary action: visually heavier than the secondary Reset button. */
    flex: 2;
}

.convert-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Reset Button Styling */
.reset-button {
    background: transparent;
    color: var(--zipper-silver);
    font-weight: 500;
    border: 1px solid var(--zipper-silver);
    box-shadow: none;
    /* Secondary/destructive action: smaller and quieter than Convert. */
    flex: 1;
}

.reset-button:hover {
    background: rgba(255, 76, 76, 0.15);
    color: var(--danger);
    border-color: var(--danger);
    transform: none;
}

/* Disabled Button State */
.button-base:disabled,
.button-base[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading State */
.button-base.loading {
    position: relative;
    color: transparent;
}

.button-base.loading::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 3px solid var(--text-light);
    border-radius: 50%;
    border-top-color: transparent;
    animation: button-spin 0.8s linear infinite;
}

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

/* Presets Styling */
/* Output Settings card: groups format/resize/quality/presets visually so
   they read as one step instead of separate dangling controls. */
.settings-card {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 10px 0;
}

.presets-label {
    margin: 20px 0 12px;
    font-size: 13px;
    color: var(--zipper-silver);
    text-align: center;
}

.presets {
    margin: 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.preset-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex: 1;
    min-width: 120px;
}

/* The button inherits flex:1 from .button-base (used elsewhere for the
   Convert/Reset row), but nested inside .preset-item's own flex:1 column
   that's a redundant nested flex-grow chain that some browsers (notably
   iOS Safari) can collapse to zero height. The button just needs to size
   to its content here. */
.preset-item .button-base {
    flex: 0 0 auto;
}

.preset-caption {
    font-size: 11px;
    color: var(--zipper-silver);
    text-align: center;
}

.presets button {
    background: rgba(0, 207, 255, 0.1);
    color: var(--text-light);
    border: 1px solid var(--primary);
    font-weight: 500;
    padding: 10px 15px;
    width: 100%;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.presets button:hover {
    background: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.presets button.active {
    background: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

.preset-icon {
    margin-right: 6px;
}

/* Footer Links */
.footer-links {
    width: 100%;
    text-align: center;
    padding: 25px 0;
    background: var(--background-light);
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-links .links-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.footer-links a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
    transform: translateX(-50%);
}

.footer-links a:hover {
    color: var(--primary-hover);
    background: rgba(0, 207, 255, 0.1);
}

.footer-links a:hover::before {
    width: 100%;
}

.footer-links p {
    color: var(--zipper-silver);
    font-size: 13px;
    margin-top: 5px;
    opacity: 0.8;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-brand-mark {
    width: 18px;
    height: 18px;
    border-radius: 22%;
    flex-shrink: 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-light);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--zipper-silver);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalopen 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
}

@media (prefers-color-scheme: dark) {
    .modal-content {
        background: var(--card-dark);
    }
}

@keyframes modalopen {
    from { opacity: 0; transform: translateY(-50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal Close Button */
.close-modal {
    color: var(--zipper-silver);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: var(--primary);
    background: rgba(0, 207, 255, 0.1);
    transform: rotate(90deg);
}

.close-modal:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 207, 255, 0.4);
}

.close-modal:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 24px;
    padding-right: 30px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content h3 {
    color: var(--primary);
    margin-top: 25px;
    font-size: 18px;
}

.modal-content ul {
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 10px;
}

.modal-content p {
    margin-bottom: 15px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    font-size: 20px;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 13px;
    font-weight: normal;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Animation Classes */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Icons */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Cropper.js brand override (default is a generic blue #39f) */
.cropper-view-box {
    outline-color: var(--primary);
}

.cropper-line {
    background-color: var(--primary);
}

.cropper-point {
    background-color: var(--primary);
}

.cropper-modal {
    background-color: #000;
    opacity: 0.65;
}
