/* Base64 Converter Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #17a2b8;
    --background: #ffffff;
    --surface: #f8f9fa;
    --text: #2c3e50;
    --text-secondary: #6c757d;
    --border: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --background: #1a1a1a;
    --surface: #2d2d2d;
    --text: #ffffff;
    --text-secondary: #b0b0b0;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: var(--text);
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: var(--text);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

h3 {
    color: var(--text);
    margin-bottom: 15px;
    font-size: 1.3em;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: var(--surface);
    color: var(--text);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    border: 2px solid transparent;
}

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

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

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

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

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

/* Converter Section */
.converter-section {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px var(--shadow);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h3 {
    margin: 0;
}

/* Action Buttons */
.input-actions, .output-actions, .decode-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
}

.link-btn:hover {
    color: var(--secondary-color);
}

/* Text Areas */
.text-area {
    width: 100%;
    min-height: 150px;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--background);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 15px;
    resize: vertical;
    transition: var(--transition);
}

.text-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.text-area[readonly] {
    background: var(--surface);
    cursor: text;
}

/* Input and Output Sections */
.input-section, .output-section {
    margin-bottom: 25px;
}

.input-info, .output-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Conversion Controls */
.conversion-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.convert-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.convert-btn.primary {
    background: var(--primary-color);
    color: white;
}

.convert-btn.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.convert-btn.secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.convert-btn.secondary:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.convert-btn.swap {
    background: var(--warning-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
}

.convert-btn.swap:hover {
    background: #e67e22;
    transform: rotate(180deg);
}

/* Upload Section */
.upload-section {
    border: 3px dashed var(--border);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 25px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.upload-section:hover {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.upload-section.dragover {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 10px;
}

.upload-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File Info */
.file-info {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-grid .info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-grid .info-item:last-child {
    border-bottom: none;
}

.info-grid .info-item span:first-child {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-grid .info-item span:last-child {
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* Image Preview */
.image-preview {
    text-align: center;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow);
    margin-bottom: 15px;
}

.image-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

/* Decode Section */
.decode-section {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px solid var(--border);
}

.decode-input-section {
    margin-top: 20px;
}

.decode-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filename-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--background);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.filename-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Instructions */
.instructions {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-top: 30px;
    box-shadow: 0 4px 6px var(--shadow);
}

.instruction-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.instruction-tab {
    background: var(--background);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border);
}

.instruction-tab h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 18px;
}

.instruction-tab ol {
    padding-left: 20px;
    margin: 0;
}

.instruction-tab li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: var(--text);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: var(--transition);
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--shadow);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 2em;
    }

    .tab-navigation {
        gap: 5px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .converter-section {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-actions, .output-actions {
        justify-content: center;
        width: 100%;
    }

    .conversion-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .convert-btn {
        justify-content: center;
    }

    .convert-btn.swap {
        align-self: center;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .input-info, .output-info {
        justify-content: center;
        text-align: center;
    }

    .decode-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .filename-input {
        min-width: auto;
    }

    .image-info {
        flex-direction: column;
        gap: 10px;
    }

    .instruction-tabs {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.mb-20 {
    margin-bottom: 20px;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 10000;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}