/* Image Resizer - Main Styles */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #8b5cf6;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    
    --bg-main: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.1);
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-light: #ffffff;
    
    --border-color: #e5e7eb;
    --border-focus: var(--primary);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-light));
    --gradient-secondary: linear-gradient(135deg, var(--secondary), var(--accent));
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark mode variables */
:root.dark-mode {
    --bg-main: radial-gradient(ellipse at center, #4c1d95 0%, #6b21a8 30%, #1e293b 60%, #0f172a 90%, #020617 100%);
    --bg-card: rgba(31, 41, 55, 0.9);
    --bg-glass: rgba(31, 41, 55, 0.7);
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: var(--transition);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: clamp(12px, 3.5vw, 32px);
    right: clamp(12px, 3.5vw, 32px);
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: clamp(44px, 6vw, 56px);
    height: clamp(44px, 6vw, 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    position: absolute;
    width: clamp(22px, 4vw, 28px);
    height: clamp(22px, 4vw, 28px);
    transition: var(--transition);
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.moon-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

:root.dark-mode .theme-toggle {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(139, 92, 246, 0.5);
}

:root.dark-mode .sun-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

:root.dark-mode .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Main Container */
.container {
    width: 100%;
    max-width: 700px;
    background: var(--bg-card);
    
    box-shadow: 15px 0px 266px #a855f7;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2rem;
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    text-align: center;
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out;
}

:root.dark-mode .container {
    background: var(--bg-card);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Header */
.header {
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Header logo */
.logo-title {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}


:root.dark-mode .header h1 {
    background: linear-gradient(135deg, #8b5cf6, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    /* color: var(--text-secondary); */
    font-size: 1.2rem;
    margin-top: 0.5rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

:root.dark-mode .header p,

:root.dark-mode .input-label {
    color: #e2e8f0;
}
:root.dark-mode .cta-text{
    color: black;
}


:root.dark-mode .site-footer a {
    color: white;
    font-size: 20px;
    font-weight: bold;
}
/* Upload Area */
.upload-area {
    border: 2px dashed #1f2937; /* Dark gray/black border */
    border-radius: 1.5rem;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    cursor: pointer;
    position: relative;
    background: #ffffff; /* Solid white */
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out 0.6s both;
    overflow: hidden;
}


.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.8s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.upload-area:hover::before {
    left: 100%;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.05);
}

.upload-content {
    position: relative;
    z-index: 1;
}

.cta-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937; /* Dark gray/black text */
    margin-bottom: 0.5rem;
}

.drag-text {
    color: #6b7280; /* Medium gray text */
    font-size: 0.95rem;
}

:root.dark-mode .drag-text,
:root.dark-mode .seo-description {
    color: gray;
}

#imageInput {
    display: none;
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937; /* Dark gray/black text */
    text-align: left;
    margin-left: 0.5rem;
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    /* border: 1px solid var(--border-color); */
    border: 1px solid #1f2937; /* Dark gray/black border */
    background: rgba(255, 255, 255, 0.9);
    /* color: var(--text-primary); */
    color: #1f2937; /* Dark gray/black text */
    font-size: 0.95rem;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

:root.dark-mode input,
:root.dark-mode select {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

input::placeholder {
    color: var(--text-muted);
}

:root.dark-mode input::placeholder {
    color: #9ca3af;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 1s both;
}

button {
    background: var(--gradient-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.site-footer {
   
    width: 100%;
     /* Dark glass style from your theme */
    color: black; /* Soft light/gray text */
    text-align: center;
    /* padding: 12px 0; */
    font-size: 14px;
    /* border-top: 1px solid var(--border-color); */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* Footer link */
  .site-footer a {
    color: var(--primary-light); /* Matches theme accents */
    text-decoration: none;
    font-weight: 500;
  }
  
  .site-footer a:hover {
    text-decoration: underline;
  }
  :root.dark-mode .site-footer {
    color: white;
}
  
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

:root.dark-mode button {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important;
}

.btn-secondary {
    /* background: var(--gradient-secondary) !important; */
    background: linear-gradient(135deg, #10b981, #34d399) !important;
}

:root.dark-mode .btn-secondary {
    background: linear-gradient(135deg, #10b981, #34d399) !important;
}

.btn-download {
    background: linear-gradient(135deg, #1a73e8, #4285f4) !important;
}

:root.dark-mode #downloadLink {
    background: linear-gradient(135deg, #3b82f6, #60a5fa) !important;
}

/* Preview Section */
.preview-section {
    margin: 2rem 0;
    animation: fadeIn 0.5s ease-out;
}

#preview {
    max-width: 100%;
    max-height: 350px;
    width: auto;
    height: auto;
    border-radius: 1rem;
    margin: 0 auto 1.5rem;
    border: 2px solid var(--border-color);
    display: none;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    object-fit: contain;
}

#preview:hover {
    transform: scale(1.02);
}

#downloadLink {
    display: none;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

#downloadLink::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#downloadLink:hover::before {
    left: 100%;
}

#downloadLink:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#canvas {
    display: none;
}

.seo-description {
    font-size: 0.9rem;
    color: #6b7280; /* Medium gray text */
    line-height: 1.6;
    margin-top: 2rem;
    padding: 1.5rem;
    /* background: #ffffff; */
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Footer */
footer {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: #6b7280; /* Medium gray text */
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

footer a {
    color: var(--primary);
    text-decoration: none;
    margin: 0 0.5rem;
    transition: var(--transition-fast);
    font-weight: 500;
}

footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}


:root.dark-mode footer a {
    color: white;
}

:root.dark-mode footer a:hover {
    color: #a78bfa;
}
 :root.dark-mode .site-footer a{
    color: var(--primary-light);
 }

/* Progress Indicator */
.progress-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(30px);
    border-radius: 2rem;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: none;
    text-align: center;
    
    min-width: 320px;
    animation: slideUp 0.4s ease-out;
}

.progress-container.active {
    display: block;
}

:root.dark-mode .progress-container {
    background: rgba(31, 41, 55, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.progress-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 8;
}

:root.dark-mode .progress-ring-circle {
    stroke: #374151;
}

.progress-ring-progress {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.progress-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

:root.dark-mode .progress-text {
    color: #8b5cf6;
}

.progress-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

:root.dark-mode .progress-subtext {
    color: #9ca3af;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    
    display: none; 
    
    animation: fadeIn 0.3s ease-out;
}

.overlay.active {
    display: block; 
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Animation */
.success-flash {
    animation: successFlash 0.6s ease-out;
}

@keyframes successFlash {
    0% { background-color: rgba(16, 185, 129, 0.1); }
    50% { background-color: rgba(16, 185, 129, 0.3); }
    100% { background-color: transparent; }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 2rem 1.5rem;
        border-radius: 1.5rem;
    }

    .header h1 {
        font-size: 2.5rem;
    }

    .header p {
        font-size: 1.1rem;
    }

    .upload-area {
        padding: 2rem 1.5rem;
    }

    .controls {
        grid-template-columns: 1fr 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    #preview {
        max-height: 250px;
    }

    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
    }

    .theme-icon {
        width: 24px;
        height: 24px;
    }

    .progress-container {
        padding: 2rem;
        min-width: 280px;
    }

    .progress-ring {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .upload-area {
        padding: 1.5rem 1rem;
    }

    .controls {
        grid-template-columns: 1fr;
    }

    button, #downloadLink {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .cta-text {
        font-size: 1.1rem;
    }

    .drag-text {
        font-size: 0.85rem;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
    }

    .theme-icon {
        width: 22px;
        height: 22px;
    }

    .progress-container {
        padding: 1.5rem;
        min-width: 260px;
    }

    .progress-ring {
        width: 80px;
        height: 80px;
    }

    .progress-icon {
        font-size: 2rem;
    }

    .progress-text {
        font-size: 1rem;
    }

    .progress-subtext {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .upload-area {
        padding: 1.25rem 0.75rem;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        top: 0.75rem;
        right: 0.75rem;
    }

    .theme-icon {
        width: 20px;
        height: 20px;
    }
}
