/* === Base Styles === */
:root {
    --color-primary: #05386B;
    --color-secondary: #379683;
    --color-accent: #5CDB95;
    --color-light-accent: #8EE4AF;
    --color-background: #EDF5E1;
    --color-text: #333;
    --color-text-light: #666;
    --color-white: #fff;
    --color-error: #e74c3c;
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 8px;
    --shadow-small: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition-speed: 0.3s;
}

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

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: var(--font-primary);
}

/* === Layout === */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    padding: 2rem 0;
    text-align: center;
}

.app-header.compact {
    padding: 1rem 0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.logo-image {
    width: 80px;
    height: 80px;
    margin-right: 1rem;
}

.logo-image.small {
    width: 50px;
    height: 50px;
}

.app-title {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin: 0;
}

.app-description {
    font-size: 1.2rem;
    color: var(--color-text-light);
}

.main-content {
    flex: 1;
    padding: 1rem 0 2rem;
}

.app-footer {
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* === Buttons === */
.primary-button {
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius);
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    box-shadow: var(--shadow-small);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-button:hover {
    background-color: #0a4b8f;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.primary-button:active {
    transform: translateY(0);
}

.secondary-button {
    background-color: var(--color-white);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--border-radius);
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    box-shadow: var(--shadow-small);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary-button:hover {
    background-color: rgba(5, 56, 107, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.secondary-button:active {
    transform: translateY(0);
}

.icon-button {
    background-color: transparent;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: background-color var(--transition-speed);
}

.icon-button:hover {
    background-color: rgba(5, 56, 107, 0.1);
}

.icon-button svg {
    width: 24px;
    height: 24px;
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* === Home Page === */
.welcome-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.welcome-section p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

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

.feature-item {
    background-color: var(--color-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-small);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.feature-item p {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 0;
}

/* === Camera Page === */
.camera-section {
    max-width: 800px;
    margin: 0 auto;
}

.camera-container {
    margin: 2rem 0;
}

.camera-frame {
    position: relative;
    width: 100%;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    aspect-ratio: 3/4;
    box-shadow: var(--shadow-medium);
}

#cameraFeed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.document-guide {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border: 2px dashed var(--color-white);
    border-radius: 8px;
    pointer-events: none;
}

.camera-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 1rem;
}

.capture-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: var(--color-white);
    border: 3px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform var(--transition-speed);
}

.capture-button:hover {
    transform: scale(1.05);
}

.capture-button:active {
    transform: scale(0.95);
}

.capture-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background-color: var(--color-primary);
}

.capture-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.instructions {
    text-align: center;
    color: var(--color-text-light);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-white);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.error-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    text-align: center;
    padding: 1rem;
    z-index: 10;
}

.hidden {
    display: none !important;
}

/* === Editor Page === */
.editor-section {
    max-width: 800px;
    margin: 0 auto;
}

.editor-container {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.image-preview-container {
    position: relative;
    width: 100%;
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-small);
}

#imagePreview {
    width: 100%;
    display: block;
}

.editor-tools {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tool-group {
    background-color: var(--color-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-small);
}

.tool-group h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.filter-options {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.filter-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 0.5rem;
    transition: border-color var(--transition-speed);
}

.filter-button.active {
    border-color: var(--color-primary);
}

.filter-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background-color: #ddd;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiM4ODgiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cmVjdCB4PSIzIiB5PSIzIiB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHJ4PSIyIiByeT0iMiI+PC9yZWN0Pjxwb2x5bGluZSBwb2ludHM9IjggMTIgMTIgMTYgMTYgMTIiPjwvcG9seWxpbmU+PGxpbmUgeDE9IjEyIiB5MT0iOCIgeDI9IjEyIiB5Mj0iMTYiPjwvbGluZT48L3N2Zz4=');
    background-position: center;
    background-repeat: no-repeat;
}

.filter-preview.original {
    background-color: #f0f0f0;
}

.filter-preview.bw {
    background-color: #333;
}

.filter-preview.contrast {
    background: linear-gradient(135deg, #000 0%, #fff 100%);
}

.adjustment-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.tool-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--color-white);
    border: 1px solid var(--color-light-accent);
    border-radius: var(--border-radius);
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    color: var(--color-primary);
    transition: background-color var(--transition-speed);
}

.tool-button:hover {
    background-color: rgba(92, 219, 149, 0.1);
}

.tool-button svg {
    width: 20px;
    height: 20px;
}

/* === Export Page === */
.export-section {
    max-width: 800px;
    margin: 0 auto;
}

.final-document-container {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.document-preview-container {
    width: 100%;
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-small);
}

#finalDocumentPreview {
    width: 100%;
    display: block;
}

.export-options {
    background-color: var(--color-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-small);
}

.export-options h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.export-button {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--color-white);
    border: 1px solid var(--color-secondary);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-size: 1rem;
    color: var(--color-primary);
    transition: background-color var(--transition-speed);
}

.export-button:hover {
    background-color: rgba(55, 150, 131, 0.1);
}

.document-info {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 1.5rem;
}

.document-info h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    margin-bottom: 0.8rem;
}

.info-label {
    width: 100px;
    font-weight: 600;
    color: var(--color-text-light);
}

.info-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: var(--font-primary);
}

/* === Responsive Styles === */
@media (min-width: 768px) {
    .editor-container {
        flex-direction: row;
    }
    
    .image-preview-container {
        flex: 2;
    }
    
    .editor-tools {
        flex: 1;
    }
    
    .final-document-container {
        flex-direction: row;
    }
    
    .document-preview-container {
        flex: 1;
    }
    
    .export-options {
        flex: 1;
    }
}

@media (max-width: 767px) {
    .app-title {
        font-size: 2rem;
    }
    
    .welcome-section h2 {
        font-size: 1.8rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .camera-controls {
        margin-top: 0.5rem;
    }
    
    .filter-options {
        flex-wrap: wrap;
    }
    
    .action-buttons {
        flex-direction: column-reverse;
        gap: 1rem;
    }
    
    .action-buttons button {
        width: 100%;
    }
}

/* === Utilities === */
.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; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
