/**
 * SmartDocu - Main Stylesheet
 * Modern, responsive design
 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-dark: #111827;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header & Navigation */
.main-header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    margin-left: 1rem;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-link {
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 0.9375rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-link {
    color: var(--primary-color);
    padding: 0.625rem 1rem;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Upload Area */
.upload-area {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    margin: 2rem 0;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
    z-index: 1;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 0;
}

.upload-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 0;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-light);
    position: relative;
    z-index: 0;
}

.upload-area .file-name {
    position: relative;
    z-index: 0;
}

.file-list {
    margin-top: 1rem;
    display: none;
}

.file-item {
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* File Order List */
.file-order-list {
    margin-top: 0.5rem;
    min-height: 100px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-secondary);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .file-order-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .file-order-list {
        grid-template-columns: 1fr;
    }
}

.file-order-hint {
    color: var(--text-light);
    font-size: 0.875rem;
    text-align: center;
    margin: 1rem 0;
    grid-column: 1 / -1;
}

.file-order-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: move;
    transition: all 0.2s;
    position: relative;
}

.file-order-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.file-order-item.dragging {
    opacity: 0.5;
    border-style: dashed;
}

.file-order-item .drag-handle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    cursor: grab;
    color: var(--text-light);
    font-size: 1rem;
    user-select: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    z-index: 1;
}

.file-order-item .drag-handle:active {
    cursor: grabbing;
}

.file-order-item .file-thumbnail {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.file-order-item .file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.file-order-item .file-thumbnail.loading {
    background: var(--bg-secondary);
}

.file-order-item .file-thumbnail .thumbnail-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.file-order-item .file-thumbnail .thumbnail-placeholder {
    font-size: 3rem;
    color: var(--text-light);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.file-order-item .file-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}

.file-order-item .file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    word-break: break-word;
    line-height: 1.3;
}

.file-order-item .file-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.file-order-item .file-number {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: var(--primary-color);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

.file-order-item .file-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-order-item .file-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Features Section */
.features {
    padding: 5rem 0;
    background: var(--bg-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* Section Styling */
.section {
    padding: 5rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.section-subtitle {
    text-align: center;
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* Process Status */
.process-status {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem 0;
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.process-status.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message {
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-message::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 1rem;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    width: 0%;
    transition: width 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* PDF Editor Styles */
.annotation {
    position: absolute;
    box-sizing: border-box;
}

.annotation.selected {
    border: 2px solid #007bff !important;
}

.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #007bff;
    border: 1px solid #fff;
    z-index: 1000;
    box-sizing: border-box;
    cursor: nw-resize;
}

.resize-handle:hover {
    background: #0056b3;
    width: 10px;
    height: 10px;
}

.resize-handle.resize-nw { cursor: nw-resize; }
.resize-handle.resize-ne { cursor: ne-resize; }
.resize-handle.resize-sw { cursor: sw-resize; }
.resize-handle.resize-se { cursor: se-resize; }
.resize-handle.resize-n { cursor: n-resize; }
.resize-handle.resize-s { cursor: s-resize; }
.resize-handle.resize-e { cursor: e-resize; }
.resize-handle.resize-w { cursor: w-resize; }

.annotation.text {
    min-width: 50px;
    min-height: 20px;
    overflow: visible;
}

.annotation.image img {
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

#highlightPreview {
    pointer-events: none;
    z-index: 999;
}

/* Processing button state */
button.processing,
.btn-primary.processing {
    position: relative;
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Footer */
.main-footer {
    background: var(--bg-dark);
    color: white;
    padding: 4rem 0 2rem;
    margin-top: 5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    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);
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-lg);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.125rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
