/* Base64 Tool - Fully Responsive Styles */

.base64-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.base64-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.base64-title {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

.base64-icon {
    font-size: 2.8rem;
    animation: spin 10s linear infinite;
    display: inline-block;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.base64-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

.base64-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Tabs */
.base64-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.base64-tab {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.7rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.base64-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

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

/* Sections */
.base64-section {
    display: none;
    animation: fadeIn 0.4s;
}

.base64-section.active {
    display: block;
}

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

.section-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.section-title .highlight {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Textarea */
.input-area {
    margin-bottom: 1.5rem;
}

.input-area label {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--text-light);
    font-weight: 500;
}

.base64-textarea {
    width: 100%;
    min-height: 140px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 1.05rem;
    resize: vertical;
    transition: all 0.3s;
}

.base64-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Result */
.result-area {
    margin: 1.5rem 0;
}

.result-label {
    font-size: 1.1rem;
    color: var(--text-light);
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
}

.result-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    min-height: 80px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    color: var(--primary);
    font-weight: 500;
    transition: all 0.3s;
}

.explanation {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
}

/* Actions */
.base64-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2rem;
}

.base64-btn {
    padding: 0.8rem 1.6rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.base64-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.base64-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border-color: #10b981 !important;
}

.download-btn:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Download Card */
.download-card-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.download-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.2);
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.dark-mode .download-card {
    background: linear-gradient(135deg, #1e1e2e, #2d2d44);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.download-card-bg-decoration {
    position: absolute;
    top: -50%;
    right: -30%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.download-card-corner-decoration {
    position: absolute;
    bottom: -20px;
    left: -20px;
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.download-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-logo-icon {
    font-size: 1.8rem;
}

.download-logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.download-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.download-card-body {
    margin: 1.5rem 0;
}

.download-mode {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.download-input-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.download-input {
    background: var(--bg);
    padding: 0.8rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.download-result-box {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    padding: 1.2rem;
    border-radius: 16px;
    text-align: center;
    margin: 1rem 0;
}

.download-result-label {
    font-size: 0.75rem;
    opacity: 0.9;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 0.5rem;
}

.download-result-value {
    font-size: 1.1rem;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.download-explanation {
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-light);
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
}

.download-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-light);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-brand {
    font-weight: 600;
    color: var(--primary);
}

/* Presets */
.base64-presets {
    margin: 3rem 0;
    text-align: center;
}

.base64-presets h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.preset-btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
    font-size: 0.9rem;
}

.preset-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Fun Fact */
.base64-funfact {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(124, 58, 237, 0.1));
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    margin: 2rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
    border-left: 3px solid var(--primary);
}

/* Reference Table */
.base64-reference {
    margin: 3rem 0;
    overflow-x: auto;
}

.base64-reference h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.base64-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
}

.base64-table th,
.base64-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.base64-table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.base64-table tr:last-child td {
    border-bottom: none;
}

.base64-table tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* SEO Section */
.base64-seo {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.base64-seo h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.base64-seo h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 1rem;
    color: var(--text);
}

.base64-seo p {
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.base64-howto-list,
.base64-features-list {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.base64-howto-list li,
.base64-features-list li {
    margin: 0.5rem 0;
    line-height: 1.5;
    color: var(--text-light);
}

/* ====================== RESPONSIVE DESIGN ====================== */

/* Tablet Styles (768px to 1024px) */
@media screen and (max-width: 1024px) {
    .base64-container {
        padding: 0 1.5rem;
        margin: 1.5rem auto;
    }

    .base64-title {
        font-size: 2.5rem;
    }

    .base64-icon {
        font-size: 2.3rem;
    }

    .base64-card {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 1.6rem;
    }
}

/* Mobile Landscape & Tablet Portrait (481px to 768px) */
@media screen and (max-width: 768px) {
    .base64-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .base64-title {
        font-size: 2rem;
    }

    .base64-icon {
        font-size: 1.8rem;
    }

    .base64-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }

    .base64-card {
        padding: 1.2rem;
    }

    .base64-tabs {
        gap: 0.4rem;
    }

    .base64-tab {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .base64-textarea {
        min-height: 120px;
        font-size: 0.95rem;
        padding: 0.8rem;
    }

    .result-box {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .explanation {
        font-size: 0.8rem;
    }

    .base64-actions {
        gap: 0.8rem;
    }

    .base64-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
    }

    .download-card {
        padding: 1.5rem;
        margin: 0 1rem;
    }

    .download-result-value {
        font-size: 0.9rem;
    }

    .download-input {
        font-size: 0.85rem;
    }

    .preset-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .base64-table th,
    .base64-table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .base64-seo {
        padding: 1.5rem;
    }

    .base64-seo h2 {
        font-size: 1.5rem;
    }

    .base64-seo h3 {
        font-size: 1.2rem;
    }

    .base64-seo p,
    .base64-howto-list li,
    .base64-features-list li {
        font-size: 0.9rem;
    }
}

/* Mobile Portrait (up to 480px) */
@media screen and (max-width: 480px) {
    .base64-container {
        padding: 0 0.75rem;
        margin: 0.75rem auto;
    }

    .base64-title {
        font-size: 1.5rem;
    }

    .base64-icon {
        font-size: 1.3rem;
    }

    .base64-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .base64-card {
        padding: 1rem;
    }

    .base64-tabs {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .base64-tab {
        width: 100%;
        text-align: center;
        padding: 0.6rem;
    }

    .section-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .input-area label {
        font-size: 0.9rem;
    }

    .base64-textarea {
        min-height: 100px;
        font-size: 0.85rem;
        padding: 0.7rem;
    }

    .result-label {
        font-size: 0.9rem;
    }

    .result-box {
        padding: 0.8rem;
        font-size: 0.8rem;
        min-height: 60px;
    }

    .explanation {
        font-size: 0.75rem;
    }

    /* Make buttons stack in 2 columns on very small screens */
    .base64-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .base64-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        width: 100%;
        text-align: center;
    }

    .download-card {
        padding: 1rem;
    }

    .download-card-header {
        flex-direction: column;
        text-align: center;
    }

    .download-mode {
        font-size: 1rem;
    }

    .download-input {
        font-size: 0.75rem;
        padding: 0.6rem;
    }

    .download-result-value {
        font-size: 0.8rem;
    }

    .download-explanation {
        font-size: 0.7rem;
    }

    .preset-buttons {
        gap: 0.6rem;
    }

    .preset-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }

    .base64-funfact {
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .base64-table th,
    .base64-table td {
        padding: 0.6rem;
        font-size: 0.75rem;
    }

    .base64-seo {
        padding: 1rem;
        margin: 2rem 0;
    }

    .base64-seo h2 {
        font-size: 1.2rem;
    }

    .base64-seo h3 {
        font-size: 1rem;
        margin: 1rem 0 0.75rem;
    }

    .base64-seo p,
    .base64-howto-list li,
    .base64-features-list li {
        font-size: 0.85rem;
    }

    .base64-howto-list,
    .base64-features-list {
        padding-left: 1rem;
    }
}

/* Extra Small Devices (up to 360px) */
@media screen and (max-width: 360px) {
    .base64-title {
        font-size: 1.3rem;
    }

    .base64-icon {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .base64-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }

    .preset-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.65rem;
    }

    .base64-table th,
    .base64-table td {
        padding: 0.5rem;
        font-size: 0.7rem;
    }

    .base64-seo h2 {
        font-size: 1rem;
    }

    .base64-seo h3 {
        font-size: 0.9rem;
    }

    .download-result-value {
        font-size: 0.7rem;
    }
}

/* Touch-friendly improvements for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .base64-tab,
    .base64-btn,
    .preset-btn {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .base64-btn:active,
    .preset-btn:active {
        transform: scale(0.98);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-rgb: 99, 102, 241;
    }
}

/* Smooth transitions for all interactive elements */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

/* Scrollbar styling */
.base64-textarea::-webkit-scrollbar,
.result-box::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.base64-textarea::-webkit-scrollbar-track,
.result-box::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 4px;
}

.base64-textarea::-webkit-scrollbar-thumb,
.result-box::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.base64-textarea::-webkit-scrollbar-thumb:hover,
.result-box::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}