/* Modern CSS with animations - Nex Neo Tech Inc. Color Scheme (Soft) */
:root {
    /* Soft Light Green/Mint Color Palette - Eye-friendly */
    --primary-color: #9fd4b7; /* Softer, more muted green for buttons */
    --primary-dark: #8bc4a3; /* Slightly darker on hover */
    --secondary-color: #c4e6d4; /* Very light mint for secondary elements */
    --success-color: #9fd4b7; /* Same as primary for success states */
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #c8e0d3; /* Much darker mint background */
    --bg-card: #d4e8dd; /* Darker mint cards */
    --bg-hover: #bdd5c8; /* Even darker mint hover */
    --text-primary: #1a2e1f; /* Dark green-gray text */
    --text-secondary: #3d5a4a; /* Darker medium green-gray */
    --border-color: #a8c9b8; /* Darker green border */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #c8e0d3 0%, #d4e8dd 50%, #c8e0d3 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 80px; /* Space for header */
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.1) 10px, rgba(255, 255, 255, 0.1) 20px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

body > * {
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #e8f5ed, #d4e8dd);
    border-bottom: 2px solid var(--primary-color);
    padding: 12px 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-info {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.header-quota {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-api-key {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-label {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.header-quota-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d7a5f;
    min-width: 30px;
    text-align: center;
    background: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-key-value {
    background: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #2d7a5f;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-key-value:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(159, 212, 183, 0.3);
}

.header-key-value:active {
    transform: scale(0.98);
}

/* Step Sections */
.step-section {
    padding: 40px 20px;
    animation: fadeIn 0.5s ease-in;
}

.step-section.active {
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

#step1 .hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 60px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    animation: slideDown 0.8s ease-out;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    animation: slideDown 0.8s ease-out 0.2s both;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(159, 212, 183, 0.2);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 2px solid var(--primary-color);
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(159, 212, 183, 0.25);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(159, 212, 183, 0.1);
    border-color: var(--primary-color);
}

.card:hover::before {
    opacity: 1;
}

.card h2, .card h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Key Panel */
.key-panel {
    padding: 40px 20px;
    animation: fadeIn 0.6s ease-in;
}

.key-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.api-key {
    background: var(--bg-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--success-color);
    border: 1px solid var(--border-color);
    flex: 1;
    min-width: 200px;
    word-break: break-all;
}

.quota-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.quota-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.quota-counter {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

.key-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* API Explorer */
.api-explorer {
    padding: 40px 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(159, 212, 183, 0.15);
}

textarea.form-control {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* Response Display */
.response-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.latency {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.response-body {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

.curl-example {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* History Section */
.history-section {
    padding: 40px 20px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideInRight 0.4s ease-out;
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.history-method {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    min-width: 60px;
    text-align: center;
}

.history-method.get { background: rgba(16, 185, 129, 0.2); color: var(--success-color); }
.history-method.post { background: rgba(99, 102, 241, 0.2); color: var(--primary-color); }
.history-method.put { background: rgba(245, 158, 11, 0.2); color: var(--warning-color); }
.history-method.delete { background: rgba(239, 68, 68, 0.2); color: var(--error-color); }

.history-path {
    flex: 1;
    margin: 0 16px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-status {
    font-weight: 600;
    margin-right: 12px;
}

.history-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Loading spinner */
.btn-loader {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-color));
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(159, 212, 183, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f5faf7, var(--bg-hover));
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(125, 211, 160, 0.2);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(159, 212, 183, 0.1);
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Image Container */
.image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 20px 0;
}

.image-container img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

#overlayCanvas {
    border-radius: 8px;
}

/* Recognized Text */
.recognized-text {
    background: var(--bg-color);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 200px;
    max-height: none;
    margin-top: 16px;
    overflow-y: auto;
    overflow-x: hidden;
}

.results-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Word Highlight */
.word-highlight {
    background: rgba(99, 102, 241, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
    cursor: pointer;
}

.word-highlight:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Responsive - Mobile Optimization */
@media (max-width: 768px) {
    body {
        padding-top: 100px; /* Space for header on mobile */
        font-size: 0.95rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    /* Header Mobile */
    .app-header {
        padding: 10px 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .header-info {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .header-quota,
    .header-api-key {
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .header-label {
        font-size: 0.8rem;
    }
    
    .header-quota-value {
        font-size: 1.1rem;
        padding: 3px 10px;
    }
    
    .header-key-value {
        max-width: none;
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .header-content .btn {
        width: 100%;
        margin-top: 5px;
    }
    
    /* Hero Section Mobile */
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    #step1 .hero {
        padding: 40px 15px;
    }
    
    /* Cards Mobile */
    .card {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .card h2, .card h3 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    /* Buttons Mobile */
    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .btn-large {
        padding: 14px 24px;
        font-size: 1rem;
    }
    
    .btn-small {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    /* Form Controls Mobile */
    .form-control {
        padding: 12px;
        font-size: 1rem;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    /* Upload Area Mobile */
    .upload-area {
        padding: 40px 15px;
        min-height: 200px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }
    
    .upload-content p {
        font-size: 0.95rem;
        margin: 8px 0;
    }
    
    .upload-hint {
        font-size: 0.85rem;
    }
    
    /* Recognized Text Mobile */
    .recognized-text {
        padding: 16px;
        font-size: 1rem;
        line-height: 1.6;
        min-height: 150px;
        max-height: 400px;
    }
    
    /* Results Actions Mobile */
    .results-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .results-actions .btn {
        width: 100%;
    }
    
    /* Image Container Mobile */
    .image-container {
        width: 100%;
        margin: 0 auto;
    }
    
    .image-container img {
        max-width: 100%;
        height: auto;
    }
    
    /* Step Sections Mobile */
    .step-section {
        padding: 20px 0;
    }
    
    /* Key Display Mobile */
    .key-display {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    /* Manual Key Section Mobile */
    .manual-key-section {
        margin-top: 20px;
        padding-top: 20px;
    }
    
    /* Docs Page Mobile */
    .docs-container {
        padding: 80px 15px 30px;
    }
    
    .docs-header h1 {
        font-size: 2rem;
    }
    
    .docs-header p {
        font-size: 1rem;
    }
    
    .endpoint-section {
        padding: 20px 15px;
    }
    
    .endpoint-path {
        font-size: 0.95rem;
        word-break: break-all;
    }
    
    .param-table {
        font-size: 0.85rem;
    }
    
    .param-table th,
    .param-table td {
        padding: 8px 6px;
    }
    
    .code-block {
        padding: 15px;
        font-size: 0.8rem;
        overflow-x: auto;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    body {
        padding-top: 110px;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .card {
        padding: 15px 12px;
    }
    
    .card h2, .card h3 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .upload-area {
        padding: 30px 12px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .recognized-text {
        padding: 12px;
        font-size: 0.95rem;
        max-height: 350px;
    }
    
    .header-quota-value {
        font-size: 1rem;
    }
    
    .header-key-value {
        font-size: 0.7rem;
    }
    
    .docs-container {
        padding: 70px 12px 25px;
    }
    
    .endpoint-section {
        padding: 15px 12px;
    }
    
    .param-table {
        font-size: 0.75rem;
    }
    
    .param-table th,
    .param-table td {
        padding: 6px 4px;
    }
}
