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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --background: #ffffff;
    --background-alt: #f9fafb;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

header {
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: inline-block;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

@media (max-width: 768px) {
    .logo-img {
        height: 32px;
    }
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dark);
}

main {
    min-height: calc(100vh - 200px);
    padding: 3rem 0;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 3rem;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.tool-card {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.tool-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: transparent;
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

.tool-icon svg {
    width: 28px;
    height: 28px;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(5deg);
}

.tool-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.375rem;
}

.tool-card p {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Individual tool card colors */
.tool-card-merge .tool-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tool-card-merge h3 {
    color: #667eea;
}

.tool-card-compress .tool-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.tool-card-compress h3 {
    color: #f5576c;
}

.tool-card-image .tool-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.tool-card-image h3 {
    color: #4facfe;
}

.tool-card-split .tool-icon {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.tool-card-split h3 {
    color: #43e97b;
}

.tool-card-rotate .tool-icon {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.tool-card-rotate h3 {
    color: #fa709a;
}

.tool-container {
    max-width: 800px;
    margin: 0 auto;
}

.tool-section {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--background-alt);
}

.file-input-label:hover {
    border-color: var(--primary-color);
    background: var(--background);
}

.file-input-label svg {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-list {
    margin-top: 1.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.file-item-name {
    font-weight: 500;
}

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

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--background);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

.btn-danger {
    background: var(--error);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid var(--error);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid var(--primary-color);
}

.content-section {
    margin-bottom: 3rem;
}

.how-to-use {
    background: var(--background-alt);
    padding: 2rem;
    border-radius: 0.5rem;
    margin: 2rem 0;
}

.how-to-use ol {
    margin-left: 1.5rem;
    margin-top: 1rem;
}

.how-to-use li {
    margin-bottom: 0.75rem;
    color: var(--text-light);
}

.faq {
    margin-top: 3rem;
}

.faq-item {
    margin-bottom: 1.5rem;
}

.faq-item h3 {
    font-size: 1.125rem;
    color: var(--text-dark);
}

.faq-item p {
    margin-top: 0.5rem;
}

.privacy-notice {
    background: #dbeafe;
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
}

.privacy-notice p {
    color: var(--text-dark);
    margin: 0;
}

/* Ad Container Styles */
.ad-container {
    margin: 2rem auto;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
}

/* Header Ad - 728x90 Leaderboard (Desktop) / 320x50 Mobile */
.ad-header {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
}

/* Rectangle Ad - 300x250 Medium Rectangle */
.ad-rectangle {
    width: 100%;
    max-width: 300px;
    min-height: 250px;
    margin: 2rem auto;
}

/* Sidebar Ad Container */
.ad-sidebar {
    position: sticky;
    top: 100px;
    width: 100%;
    max-width: 300px;
    min-height: 250px;
}

/* Two Column Layout for Content + Sidebar Ad */
.content-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

.main-content {
    min-width: 0;
}

.sidebar-ads {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Responsive Ad Display */
@media (max-width: 1024px) {
    .content-with-sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar-ads {
        display: none;
    }
}

@media (max-width: 768px) {
    .ad-header {
        max-width: 320px;
        min-height: 50px;
    }
    
    .ad-container {
        min-height: 50px;
    }
}

/* Legacy placeholder styling (for reference/backup) */
.ad-placeholder {
    background: var(--background-alt);
    border: 1px dashed var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    margin: 2rem 0;
    border-radius: 0.375rem;
}

footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: white;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.loading {
    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 0.6s linear infinite;
}

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

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--background-alt);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

select, input[type="text"], input[type="email"], input[type="number"], textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 1rem;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--background);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-md);
        gap: 0;
    }
    
    nav ul.active {
        display: flex;
    }
    
    nav li {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}
