:root {
    --primary-color: #e5322d;
    --primary-hover: #cc2a26;
    --background-color: #f7f9fa;
    --surface-color: #ffffff;
    --text-main: #333333;
    --text-muted: #777777;
    --border-color: #eaeaea;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header */
header {
    background-color: var(--surface-color);
    box-shadow: var(--shadow-sm);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
}

.logo span {
    color: var(--primary-color);
    margin-left: 2px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.auth-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-login {
    background: transparent;
    color: var(--text-main);
}

.btn-login:hover {
    background: var(--border-color);
}

.btn-signup {
    background: var(--primary-color);
    color: white;
    margin-left: 10px;
}

.btn-signup:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(180deg, #fcebeb 0%, #f7f9fa 100%);
}

.hero h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.hero p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-container {
    padding: 40px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.tool-card {
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

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

.tool-icon {
    width: 50px;
    height: 50px;
    background-color: #fbecec;
    color: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.tool-card h3 {
    margin-bottom: 10px;
    font-size: 20px;
}

.tool-card p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Specific Tool Page */
.tool-page-header {
    text-align: center;
    padding: 60px 20px 20px;
}

.tool-page-header h1 {
    font-size: 36px;
    margin-bottom: 15px;
}

.tool-page-header p {
    color: var(--text-muted);
    font-size: 18px;
}

.uploader-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 60px 20px;
    background: var(--surface-color);
    border: 2px dashed #d1d5db;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.uploader-container.drag-active {
    border-color: var(--primary-color);
    background-color: #fdf2f2;
}

.uploader-container .btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-block;
    margin-bottom: 15px;
    box-shadow: var(--shadow-md);
    transition: background 0.2s ease;
}

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

.uploader-container p {
    color: var(--text-muted);
}

#file-input {
    display: none;
}

/* File Preview Area */
#file-preview {
    max-width: 800px;
    margin: 20px auto;
    display: none;
}

.file-item {
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

/* Action actions */
.action-area {
    text-align: center;
    margin-top: 30px;
    display: none;
}

/* Loading Spinner */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loading-area {
    display: none;
    text-align: center;
    margin: 50px 0;
}

/* SEO Content Area */
.seo-content {
    max-width: 1000px;
    margin: 80px auto;
    padding: 0 20px;
}

.seo-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.seo-content p {
    margin-bottom: 15px;
    color: #4a4a4a;
}

/* Footer */
footer {
    background: #111;
    color: #fff;
    padding: 40px 5%;
    margin-top: 60px;
    text-align: center;
}

footer a {
    color: #aaa;
    margin: 0 10px;
}

footer a:hover {
    color: #fff;
}

/* Dropdowns */
.dropdown {
    position: relative;
    display: inline-block;
    padding: 10px 0;
}

.dropdown > a {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--surface-color);
    min-width: 400px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    border-radius: var(--radius-md);
    padding: 20px;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--border-color);
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dropdown:hover .dropdown-content {
    display: grid;
    animation: fadeInMenu 0.2s ease forwards;
}

.dropdown-column h4 {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.dropdown-column a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.1s ease;
}

.dropdown-column a i {
    width: 20px;
    color: var(--primary-color);
    text-align: center;
    font-size: 16px;
}

.dropdown-column a:hover {
    color: var(--primary-color);
}

/* Mega menu for All Tools */
.mega-menu {
    min-width: 900px;
    grid-template-columns: repeat(6, 1fr);
    padding: 25px;
    gap: 15px;
    left: auto;
    right: -20px; /* Align near the right edge of the screen */
    transform: none;
}

@keyframes fadeInMenu {
    from { opacity: 0; margin-top: 10px; }
    to { opacity: 1; margin-top: 0; }
}

/* Workspace Layout */
.workspace-layout {
    display: flex;
    height: calc(100vh - 70px);
    background-color: #f0f2f5;
    overflow: hidden;
}

.workspace-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    position: relative;
    display: flex;
    justify-content: center;
}

.file-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-content: flex-start;
    max-width: 1000px;
}

.workspace-sidebar {
    width: 320px;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.sidebar-body {
    flex: 1;
    padding: 24px;
}

.info-box {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.info-box p {
    font-size: 13px;
    color: #0056b3;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* UI Elements */
.btn-floating-add {
    position: fixed;
    top: 100px;
    right: 350px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(229, 50, 45, 0.4);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: transform 0.2s ease;
}

.btn-floating-add:hover {
    transform: scale(1.1);
    background-color: var(--primary-hover);
}

.btn-huge-action {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 6px 15px rgba(229, 50, 45, 0.3);
}

.btn-huge-action:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(229, 50, 45, 0.4);
}

.btn-huge-action:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* File Cards */
.file-card {
    width: 180px;
    height: 240px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    padding: 15px;
    position: relative;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.file-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.file-card-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.file-card:hover .file-card-remove {
    opacity: 1;
}

.file-card-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: var(--primary-color);
}

.file-card-name {
    padding-top: 10px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.file-card-size {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

/* ==========================================
   MOBILE & RESPONSIVE STYLES
   ========================================== */

.mobile-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-main);
}

.mobile-menu-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1000;
    box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-menu-drawer.open {
    left: 0;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-drawer {
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.drawer-content a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    font-weight: 500;
    border-bottom: 1px solid #f9f9f9;
}

.drawer-content a i {
    width: 20px;
    color: var(--primary-color);
}

.drawer-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

.drawer-footer {
    display: flex;
    gap: 15px;
}

.drawer-footer a {
    font-size: 13px;
    color: var(--text-muted);
    border: none;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.mobile-menu-overlay.show {
    display: block;
}

@media (max-width: 1024px) {
    .mega-menu {
        min-width: 700px;
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    header {
        padding: 15px 20px;
    }

    .nav-links {
        display: none; /* Hide standard nav on mobile */
    }

    .mobile-toggle {
        display: block;
    }

    .hero {
        padding: 60px 20px;
    }

    .hero h1 {
        font-size: 32px;
    }

    /* Workspace Stacking */
    .workspace-layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .workspace-sidebar {
        width: 100%;
        height: auto;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }

    .workspace-content {
        padding: 20px;
        height: 60vh;
    }

    .file-grid {
        justify-content: center;
    }

    .btn-floating-add {
        right: 20px;
        top: auto;
        bottom: 20px;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 28px;
    }

    .tool-page-header h1 {
        font-size: 28px;
    }

    .uploader-container {
        padding: 40px 15px;
    }

    .file-card {
        width: 140px;
        height: 180px;
    }

    .file-card-icon {
        font-size: 48px;
    }
}

/* Custom Scrollbar for Workspace */
.workspace-content::-webkit-scrollbar {
    width: 8px;
}

.workspace-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.workspace-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.workspace-content::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* SortableJS Styles */
.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary-color) !important;
}

.file-card {
    cursor: grab;
}

.file-card:active {
    cursor: grabbing;
}

.file-card-remove {
    z-index: 5;
}

/* Page Card for Organize Tool */
.page-card {
    position: relative;
    padding: 15px;
    height: auto;
}

.page-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--primary-color);
    color: white;
    font-size: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-thumbnail {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.page-card:hover .page-thumbnail {
    transform: scale(1.02);
}
