@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --bg-gradient-1: #e0c3fc;
    --bg-gradient-2: #8ec5fc;
    --text-dark: #1F2937;
    --text-light: #6B7280;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --tool-card-bg: rgba(255, 255, 255, 0.6);
    --tool-card-bg-hover: rgba(255, 255, 255, 0.9);
    --tool-card-active: #ffffff;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --text-dark: #f3f4f6;
    --text-light: #9ca3af;
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --tool-card-bg: rgba(15, 23, 42, 0.6);
    --tool-card-bg-hover: rgba(15, 23, 42, 0.9);
    --tool-card-active: rgba(79, 70, 229, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-dark);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

header {
    text-align: center;
    padding: 2rem 1rem 1rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}

header p {
    color: var(--text-light);
    font-size: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Glassmorphism Panel Layout */
.main-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    gap: 2rem;
}

/* Sidebar Tool Selector */
.sidebar {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-right: 2px solid rgba(255,255,255,0.4);
    padding-right: 1.5rem;
    max-height: 550px;
    overflow-y: auto;
}

/* Custom Webkit Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.tool-card {
    background: var(--tool-card-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateX(5px);
    background: var(--tool-card-bg-hover);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.tool-card.active {
    background: var(--tool-card-active);
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(79, 70, 229, 0.15);
}

.tool-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.tool-card h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

/* Upload Area */
.upload-area {
    width: 100%;
    max-width: 600px;
    border: 3px dashed var(--primary);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover, .upload-area.dragover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--primary-hover);
}

.upload-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-text h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.upload-text p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
}

.btn.success {
    background: var(--secondary);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn.success:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

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

/* File Info & Progress */
.file-process-wrapper {
    width: 100%;
    max-width: 600px;
    display: none;
    flex-direction: column;
    align-items: center;
}

.file-info {
    background: var(--tool-card-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    color: var(--text-dark);
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.file-size {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.processing-hint {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--primary);
    margin-top: 8px;
    opacity: 0;
    display: none;
    animation: pulse-fade 3s ease-in-out infinite;
}

@keyframes pulse-fade {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.progress-bar {
    height: 100%;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    background-color: var(--primary);
    border-radius: 10px;
    width: 0%;
    animation: progress-stripes 1s linear infinite;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

@keyframes progress-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

.status-text {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--text-dark);
}

.theme-toggle-wrapper {
    position: absolute;
    right: 20px;
    top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.theme-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: var(--text-dark);
    cursor: pointer;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}
.theme-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
}

.theme-toggle-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* On mobile, adjust the position */
@media (max-width: 768px) {
    .theme-toggle-wrapper {
        top: 10px;
        right: 10px;
    }
}

/* Loader */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    display: none;
}

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

/* Result Section */
.result-section {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
    text-align: center;
}

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

footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 600px;
    display: none;
    font-weight: 500;
}

.alert.error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #F87171;
}

.alert.success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #34D399;
}

/* Mobile Back Button */
.mobile-back-btn {
    background: #f1f5f9;
    color: var(--text-dark);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    transition: all 0.3s;
}
.mobile-back-btn:hover {
    background: #e2e8f0;
}
.mobile-back-btn i {
    color: var(--primary);
}

@media (max-width: 768px) {
    .main-panel {
        flex-direction: column;
        padding: 1.5rem;
    }
    .sidebar {
        flex: none;
        border-right: none;
        padding-right: 0;
        /* Sidebar is shown by default on mobile */
        display: flex; 
        max-height: none;
        overflow-y: visible;
    }
    .content-area {
        /* Content area is hidden by default on mobile */
        display: none;
    }
    .tool-card {
        padding: 0.8rem;
    }
    .mobile-back-btn {
        display: inline-flex !important;
    }

    /* Toggled by JS when a tool is clicked */
    .main-panel.mobile-view-content .sidebar {
        display: none;
    }
    .main-panel.mobile-view-content .content-area {
        display: flex;
    }
}

/* Advertisement Spaces */
.ad-banner {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: 600px;
    max-height: 90vh; /* Don't exceed page height */
    background: var(--glass-bg);
    border: 2px dashed rgba(79, 70, 229, 0.4);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
    font-weight: bold;
    backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
    z-index: 10;
}
.left-ad { left: 20px; }
.right-ad { right: 20px; }

/* Hide ads on smaller screens to avoid overlapping content */
@media (max-width: 1400px) {
    .ad-banner { display: none; }
}

/* Blog Card Styles */
.blog-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.2rem;
    width: 260px;
    text-decoration: none;
    color: var(--text-dark);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.blog-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}
.blog-card .card-icon {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.8rem;
}
.blog-card h4 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}
.blog-card p {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
}
.security-card:hover {
    border-color: #10B981;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
    transform: none;
}
