/* 
    ==========================================================
    MAS ANDY PDF TOOLS - PREMIUM DESIGN SYSTEM (V3)
    Focus: Elegance, Professionalism, and High-Performance UI
    ==========================================================
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Professional Palette - Modern Slate & Indigo */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --secondary: #6366f1;
    --accent: #8b5cf6;
    
    /* Backgrounds */
    --bg-main: #f8fafc;
    --bg-sidebar: #0f172a; /* Deep Slate */
    --bg-card: #ffffff;
    
    /* Text */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-dark: #f1f5f9;
    
    /* UI Elements */
    --border: #e2e8f0;
    --ring: rgba(79, 70, 229, 0.4);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Dark Mode Overrides */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-theme {
    --bg-main: #020617;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --bg-sidebar: #020617; /* Even darker in dark mode */
}

/* Base Resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Layout */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling - Modern Dark Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand i {
    font-size: 1.8rem;
    color: #818cf8; /* Light Indigo */
}

.sidebar-brand span.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 0 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

.sidebar-divider {
    padding: 1.5rem 0.75rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* Tab Selection - Professional Pills */
.tab-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    margin-bottom: 2px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
}

.tab-btn i {
    font-size: 1.1rem;
    width: 20px;
}

.tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.tab-btn.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.tab-btn.active i {
    color: white !important;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 280px; /* Space for sidebar */
    padding: 2rem 3rem;
    max-width: 1200px;
}

/* Header & Subtitle */
.content-header {
    margin-bottom: 3rem;
}

.content-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.content-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Tool Sections */
.tool-content {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3.5rem;
    box-shadow: var(--shadow-sm);
    animation: slideUp 0.4s ease-out forwards;
    max-width: 900px;
    margin: 0 auto;
}

.tool-content.active {
    display: block;
}

#home-dashboard {
    max-width: 1400px;
}

.tool-header-block {
    text-align: center;
    margin-bottom: 2.5rem;
}

.tool-header-block h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.tool-header-block p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Professional Buttons */
.action-btn {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.action-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.action-btn.secondary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.action-btn.secondary:hover {
    background-color: var(--primary);
    color: white;
}

.action-btn:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* File Drop Zone - Premium Feel */
.file-upload-block {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-main);
    cursor: pointer;
    margin-bottom: 2rem;
}

.file-upload-block:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload-block i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.file-upload-block span {
    font-weight: 500;
    color: var(--text-main);
    display: block;
    margin-bottom: 0.5rem;
}

.file-upload-block small {
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* Loader - Glassmorphism */
#loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

/* Form Styles */
.pdf-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.pdf-options label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.text-input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition);
}

.text-input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--ring);
}

/* Footer Nav */
.top-nav {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.top-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.top-nav a:hover {
    color: var(--primary);
}

/* Modal System - Premium Glassmorphism */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 24px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Chained Task Success Modal */
.chained-task-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.seo-section {
    margin-top: 4rem;
    padding: 3rem;
    background: var(--primary-light);
    border-radius: 20px;
    border: 1px solid var(--primary);
}

.seo-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.seo-section p {
    color: var(--text-main);
    line-height: 1.6;
}

.seo-section ul {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    list-style: none;
}

.seo-section li {
    padding: 10px;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 4px solid var(--primary);
}

/* Home Dashboard & Tool Grid */
.welcome-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    padding: 3.5rem 2.5rem;
    border-radius: 24px;
    color: white;
    margin-bottom: 2.5rem;
    text-align: left;
    box-shadow: var(--shadow-lg);
}

.welcome-banner h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -1px;
}

.welcome-banner p {
    font-size: 1.15rem;
    opacity: 0.9;
    font-weight: 400;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.tool-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.tool-card i {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

.tool-card h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.tool-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Scrollbar Style */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Responsive - Final Adjustments */
@media (max-width: 1024px) {
    .sidebar { width: 80px; }
    .sidebar-brand h1, .tab-btn span, .sidebar-divider, .sidebar-brand span { display: none; }
    .sidebar-brand, .tab-btn { justify-content: center; padding: 1rem; }
    .main-content { margin-left: 80px; padding: 2rem; }
    .sidebar-brand i { font-size: 2rem; }
}

@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        height: auto; 
        position: relative; 
        flex-direction: row;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .sidebar-brand { padding: 1rem; border-right: 1px solid rgba(255,255,255,0.1); }
    .sidebar-nav { 
        display: flex; 
        overflow-x: auto; 
        padding: 0.5rem; 
        margin-bottom: 0;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    .tab-btn { width: auto; white-space: nowrap; padding: 0.75rem 1.25rem; }
    .main-content { margin-left: 0; padding: 1.5rem; }
    .welcome-banner { padding: 2rem; margin-bottom: 1.5rem; }
    .welcome-banner h1 { font-size: 1.75rem; }
}
/* Scan Previews */
.scan-preview-item {
    transition: var(--transition);
    animation: slideUp 0.3s ease-out;
}

.scan-preview-item:hover {
    transform: scale(1.05);
    z-index: 10;
}

#scan-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

@media (max-width: 768px) {
    #scan-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* ESign Signature Indicator styling */
.sig-indicator {
    position: absolute;
    border: 2px dashed var(--primary);
    background-color: rgba(79, 70, 229, 0.08);
    cursor: grab;
    box-sizing: border-box;
    display: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), var(--shadow-md);
    z-index: 10;
}

.sig-indicator:hover, .sig-indicator:active {
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), var(--shadow-lg);
}

.sig-indicator:active {
    cursor: grabbing;
}

.esign-preview-container {
    max-width: 100%;
    overflow-x: auto;
    padding: 15px;
    background-color: var(--bg-main);
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
}
