:root {
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --background-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-background: #ffffff;
    --input-background: #ffffff;
}

[data-theme="dark"] {
    --primary-color: #0a84ff;
    --primary-hover: #1a94ff;
    --text-color: #f5f5f7;
    --text-secondary: #86868b;
    --border-color: #424245;
    --background-color: #000000;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-background: #1d1d1f;
    --input-background: #2c2c2e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    justify-content: center;
    padding: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}
main{
    width: 100%;
}
.container {
    width: 100%;
    max-width: 800px;
    padding: 1rem;
    animation: fadeIn 0.5s ease-out;
    position: relative;
    margin: 0 auto;
}

.theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    color: var(--text-color);
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    background-color: var(--border-color);
    justify-content: center;
    outline: none;
    box-shadow: none;
    z-index: 99999;

}
.theme-toggle::selection {
    background: transparent;
    color: inherit;
}
.theme-toggle:hover {
    background-color: var(--border-color);
    opacity: 0.9;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

.header {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: slideDown 0.5s ease-out;
}

.title {
    font-size: clamp(2rem, 2.5rem, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, var(--primary-color), #34c759);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: clamp(1rem, 1.1rem, 1.1rem);
}

.converter-container {
    background: var(--card-background);
    border-radius: 20px;
    box-shadow: 0 4px 20px var(--shadow-color);
    padding: 1.5rem;
    animation: slideUp 0.5s ease-out;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.format-selector label {
    font-size: clamp(0.875rem, 1rem, 1rem);
    margin-bottom: 5px;
    display: block;
}
.drop-zone:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 113, 227, 0.02);
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background-color: rgba(0, 113, 227, 0.05);
}

.upload-icon {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    width: 36px;
    height: 36px;
}

.or {
    color: var(--text-secondary);
    margin: 0.75rem 0;
}
footer{
    position: fixed;
    bottom: 0;
    width: 100%;
    left: 0;
    padding: 1rem;
    background: var(--background-color);
    text-align: center;
}

.browse-button,
.download-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(15px, 1rem, 1rem);
}

.browse-button:hover,
.download-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.file-input {
    display: none;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 20px;
}

.format-selector {
    flex: 1;
}

.format-select {
    width: 100%;
    padding: 0.75rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-background);
    font-size: clamp(15px, 1rem, 1rem);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    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='%2386868b' 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 0.75rem center;
    background-size: 1rem;
}

.format-select:disabled {
    cursor: not-allowed;
}
[data-theme="dark"] .format-select {
    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='%23f5f5f7' 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");
}

.convert-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: clamp(0.875rem, 1rem, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

.convert-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.convert-button:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.convert-button .tick {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 0.5rem;
    vertical-align: middle;
    opacity: 0;
    transition: all 0.3s ease;
}

.convert-button.downloaded .tick {
    width: 16px;
    height: 16px;
    opacity: 1;
}

.convert-button.downloaded {
    background-color: #10B981;
}

.convert-button.downloaded:hover {
    background-color: #059669;
}

.preview-section {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-out;
    flex-direction: column;
}
.single-preview img{
    width: 100%;
}

.preview-container {
    flex: 0 0 100%;
    min-width: 0;
    width: 100%;
}

.single-preview {
    width: 100%;
}

.multiple-previews {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.multiple-previews .clear-batch {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: clamp(14px, 1.2rem, 1rem);
    padding: 0.5rem;
    transition: color 0.2s ease;
    margin-bottom: 0.5rem;
}

.multiple-previews .clear-batch:hover {
    color: var(--primary-hover);
}

.multiple-preview-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    position: relative;
    margin-bottom: 15px;
}

.multiple-preview-item .remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multiple-preview-item .remove:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.multiple-preview-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    background-color: var(--text-color);
}

.multiple-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 40px;
    width: 100%;
}

.multiple-preview-info .name {
    font-weight: 500;
    color: var(--text-color);
    word-break: break-word;
}

.multiple-preview-info .size {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.download-container {
    flex: 0 0 calc(40% - 1.5rem);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.preview-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 1rem, 1rem);
    margin-top: 10px;

}
.multiple-preview-item .remove span{
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.multiple-preview-item .remove span svg{
    width: 8px;
    height: auto;
}
.toast {
    position: fixed;
    bottom: 13px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card-background);
    color: var(--text-color);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    opacity: 0;
    z-index: 9;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
    font-size: clamp(1rem, 1.2rem, 1.2rem);
}

.toast.show {
    transform: translateX(-50%) translateY(0px);
    opacity: 1;
}

.toast.success {
    background: #10B981;
    color: white;
}

.toast.error {
    background: #EF4444;
    color: white;
}

.toast .error-text {
    color: #EF4444;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@media (min-width: 1920px) {
    .container {
        max-width: 80%;
        padding: 1.5rem;
    }

    .title {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .converter-container {
        padding: 2rem;
        border-radius: 2rem;
        gap: 1.5rem;
    }

    .drop-zone {
        padding: 3rem;
        border-radius: 1.6rem;
        margin-bottom: 2rem;
    }

    .upload-icon {
        width: 4rem;
        height: 4rem;
        margin-bottom: 1rem;
    }

    .or {
        margin: 1rem 0;
        font-size: 1.1rem;
    }

    .browse-button,
    .download-button {
        padding: 0.75rem 1.5rem;
        border-radius: 0.8rem;
        font-size: 1rem;
    }

    .convert-button {
        padding: 1rem 2rem;
        border-radius: 0.75rem;
        font-size: 1.2rem;
    }

    .format-select {
        padding: 0.75rem;
        padding-right: 2.5rem;
        border-radius: 0.8rem;
        font-size: 1rem;
        background-position: right 0.75rem center;
        background-size: 1rem;
    }

    .preview-section {
        gap: 1.5rem;
        min-height: 30rem;
    }

    .preview-image {
        width: 5rem;
        height: 5rem;
        border-radius: 0.4rem;
    }

    .preview-info {
        font-size: 0.9rem;
    }

    .theme-toggle {
        width: 4rem;
        height: 4rem;
        bottom: 1.5rem;
        right: 1.5rem;
    }

    .theme-toggle svg {
        width: 2rem;
        height: 2rem;
    }

    .toast {
        padding: 0.75rem 1.5rem;
        border-radius: 0.8rem;
        font-size: 1rem;
        bottom: 1.5rem;
    }

    .multiple-previews {
        gap: 1.5rem;
        padding: 0.5rem;
    }

    .multiple-previews .clear-batch {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .multiple-preview-item {
        gap: 1rem;
        padding: 0.75rem;
        border-radius: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .multiple-preview-item .remove {
        top: 0.5rem;
        right: 0.5rem;
        width: 1.5rem;
        height: 1.5rem;
    }

    .multiple-preview-info {
        gap: 0.25rem;
    }
}
@media (min-width: 1199px) {
    footer{
        position: fixed;
        bottom: 0;
        width: 200px;
        left: 0;
        padding: 1rem 0;
        background: var(--background-color);
        text-align: center;
    }
    .footer-text{
        text-align: left;
    }
}
@media (max-width: 1198px) {
    footer{
        position: relative;
        bottom: 0;
        width: 100%;
        left: 0;
        padding: 1rem;
        padding-bottom: 0;
        background: transparent;
        text-align: center;
    }
    main {
        min-height: calc(100dvh - 95px);
    }
}
@media (max-width: 640px) {
    footer{
        position: relative;
        bottom: 0;
        width: 100%;
        left: 0;
        padding: 1rem;
        padding-bottom: 0;
        background: transparent;
        text-align: center;
    }
    .theme-toggle{
        bottom: 13px;
    }
    .toast {
        width: 90%;
        text-align: center;
        font-size: clamp(0.9rem, 1rem, 1rem);
        border-radius: 18px;
    }
    
    .converter-container {
        margin-bottom: 60px;
    }
    
    .container {
        padding: 0.5rem;
    }

    .title {
        font-size: clamp(1.75rem, 2rem, 2rem);
    }

    .subtitle {
        font-size: clamp(0.9rem, 1rem, 1rem);
    }

    .controls {
        flex-direction: column;
    }

    .drop-zone {
        padding: 1.5rem;
    }

    .preview-section {
        flex-direction: column;
        gap: 1rem;
        min-height: auto;
    }

    .preview-container,
    .download-container {
        flex: 0 0 100%;
        width: 100%;
    }

    .browse-button,
    .convert-button,
    .download-button {
        font-size: clamp(14px, 1rem, 1rem);
    }

    .multiple-preview-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .multiple-preview-item img {
        width: 100%;
        height: auto;
        max-height: 200px;
        object-fit: contain;
    }

    .multiple-preview-item .remove {
        top: 12px;
        right: 12px;
        font-size: 17px;
    }
  
    .convert-button {
        padding: 0.625rem 1.25rem;
        border-radius: 0.375rem;
    }

    .preview-image {
        width: 60px;
        height: 60px;
    }

    .multiple-preview-item {
        gap: 0.75rem;
        padding: 0.5rem;
    }
}

.batch-controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.batch-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: clamp(14px, 1.2rem, 1rem);
}

.clear-batch {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: clamp(14px, 1.2rem, 1rem);
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.clear-batch:hover {
    color: var(--primary-hover);
}

.batch-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    max-height: 1000px;
    overflow-y: auto;
    padding: 0.5rem;
}

.thumbnail {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thumbnail:hover .remove {
    opacity: 1;
}

@media (min-width: 1920px) {
    .batch-controls {
        margin-top: 1.5rem;
        padding: 1rem;
        border-radius: 1.2rem;
    }

    .batch-info {
        margin-bottom: 1rem;
    }

    .batch-preview {
        gap: 1rem;
        max-height: 20rem;
    }

    .thumbnail {
        border-radius: 0.8rem;
    }

    .thumbnail .remove {
        width: 1.5rem;
        height: 1.5rem;
    }
}

@media (max-width: 640px) {
    .batch-preview {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
}

.preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    background: var(--card-background);
    width: 100%;
}

.clear-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: clamp(14px, 1.2rem, 1rem);
    padding: 0.5rem;
    transition: color 0.2s ease;
    padding: 0;
}

.clear-button:hover {
    color: var(--primary-hover);
}

.download-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(15px, 1.5rem, 1rem);
}

.download-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.download-button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.drop-zone-content p {
    color: var(--text-secondary);
    font-size: clamp(1rem, 1.2rem, 1.2rem);
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    body{
        padding-top: 25px;
    }
    .drop-zone-content p {
        max-width: 200px;
        margin: 0 auto 14px;
    }
    .preview-controls {
        padding: 0;
    }

    .footer-text {
        text-align: center;
    }
}

.footer-text {
    padding: 8px 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-text a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-text a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

@media (max-width: 640px) {
    .footer-text {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }

}
