/* Online Web Tools - Main Stylesheet */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.navbar-brand h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.navbar-menu a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s;
}

.navbar-menu a:hover {
    color: var(--primary-color);
}

.user-name {
    font-weight: 600;
    color: var(--primary-color);
}

.btn-login, .btn-register, .btn-logout {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-login {
    color: var(--primary-color);
}

.btn-register {
    background: var(--primary-color);
    color: white;
}

.btn-logout {
    background: var(--error-color);
    color: white;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 3rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 1rem;
    margin-bottom: 3rem;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.25rem;
    color: #64748b;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Features Section */
.features {
    margin: 4rem 0;
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

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

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.feature-card h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.tool-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

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

.tool-card h3, .tool-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: #64748b;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.tool-stats {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

/* Forms */
.tool-form, .auth-form {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.85rem;
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: normal;
}

.radio-group input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Results */
.result-section {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.result-box {
    background: #f1f5f9;
    padding: 1.5rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
    word-break: break-all;
}

.result-box p, .result-box pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--text-color);
}

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

.stat-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
    border-left: 4px solid;
}

.alert-error {
    background: #fef2f2;
    border-color: var(--error-color);
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success-color);
    color: #15803d;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: var(--info-color);
    color: #1e40af;
}

.alert ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.alert code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.alert pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin-top: 0.5rem;
}

/* Auth Section */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem 0;
}

.auth-container {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.auth-container > p {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #64748b;
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* History Table */
.history-table {
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin: 2rem 0;
}

.history-table table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: #f1f5f9;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.history-table tr:hover {
    background: #f8fafc;
}

.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* CTA Section */
.cta {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 1rem;
    margin: 3rem 0;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

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

/* Footer */
.footer {
    background: #1e293b;
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
}

.footer p {
    margin: 0.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-menu {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

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

    .radio-group {
        flex-direction: column;
        gap: 1rem;
    }

    .auth-container {
        max-width: 100%;
    }

    .history-table {
        font-size: 0.9rem;
    }

    .history-table th,
    .history-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Search Input */
.search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    margin: 1rem 0;
}

.tools-filter {
    text-align: center;
    margin: 2rem 0;
}

.tool-category {
    margin: 2rem 0;
}

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

/* Tool Section */
.tool-section {
    margin: 2rem 0;
}

.tool-section h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tool-section > p {
    color: #64748b;
    margin-bottom: 2rem;
}

.tool-container {
    max-width: 800px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card, .tool-card, .result-section {
    animation: fadeIn 0.3s ease-out;
}

/* File List Display */
.file-list {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.file-list h4 {
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-size: 0.875rem;
}

.file-list ul {
    list-style: none;
    padding: 0;
}

.file-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    color: #64748b;
    font-size: 0.875rem;
}

.file-list li:last-child {
    border-bottom: none;
}

/* Tool Info Section */
.tool-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f0f4ff;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

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

.tool-info ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.tool-info ol li {
    margin-bottom: 0.5rem;
    color: #475569;
}

.tool-info .page-range-examples {
    background: white;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

.tool-info .page-range-examples ul {
    list-style: none;
    margin-top: 0.5rem;
}

.tool-info .page-range-examples li {
    margin-bottom: 0.25rem;
    color: #64748b;
}

.tool-info .page-range-examples code {
    background: #e0e7ff;
    color: var(--primary-color);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Image Preview */
.image-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.375rem;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
}

.image-preview p {
    margin-top: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group.half {
    flex: 1;
}

/* Checkbox Group */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Quality Slider */
.quality-slider, .size-slider {
    width: 100%;
    margin: 0.5rem 0;
}

/* Compression Stats */
.compression-stats {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row.savings {
    color: var(--success-color);
    font-weight: 600;
}

/* QR Code Generator */
.qr-result {
    text-align: center;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.qr-image {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
}

.qr-text {
    margin-top: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 0.25rem;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.875rem;
    color: #64748b;
}

.qr-presets {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f0f4ff;
    border-radius: 0.375rem;
}

.qr-presets h4 {
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.preset-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
}

/* Alert Success */
.alert-success {
    background: #ecfdf5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-success h3 {
    color: #065f46;
    margin-bottom: 0.5rem;
}

.alert-success .btn-success {
    background: var(--success-color);
    color: white;
    margin-right: 0.5rem;
}

.alert-success .btn-success:hover {
    background: #059669;
}

/* Result Textarea */
.result-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-family: monospace;
    font-size: 0.875rem;
    resize: vertical;
}

.result-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Text Compare Styles */
.compare-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.375rem;
}

.compare-stats .stat {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.compare-stats .stat.added {
    background: #d1fae5;
    color: #065f46;
}

.compare-stats .stat.removed {
    background: #fee2e2;
    color: #991b1b;
}

.compare-stats .stat.modified {
    background: #dbeafe;
    color: #1e40af;
}

.compare-stats .stat.similarity {
    background: #f3f4f6;
    color: #374151;
}

.diff-view {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    font-family: monospace;
    font-size: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
}

.diff-line {
    display: flex;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.diff-line:last-child {
    border-bottom: none;
}

.diff-line.added {
    background: #d1fae5;
}

.diff-line.removed {
    background: #fee2e2;
}

.diff-line.same {
    background: white;
}

.diff-line .line-num {
    width: 50px;
    color: #94a3b8;
    text-align: right;
    padding-right: 0.5rem;
    flex-shrink: 0;
}

.diff-line .line-content {
    white-space: pre-wrap;
    word-break: break-all;
}

/* Mode Selector */
.mode-selector .radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Code Result */
.code-result {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.code-result code {
    background: none;
    padding: 0;
}

/* Entity Table */
.entity-table {
    background: #f8fafc;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
}

.entity-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-family: monospace;
}

.entity-row:last-child {
    border-bottom: none;
}

/* Color Legend */
.color-added {
    color: #065f46;
    font-weight: 600;
}

.color-removed {
    color: #991b1b;
    font-weight: 600;
}

.color-modified {
    color: #1e40af;
    font-weight: 600;
}

/* Form Select */
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* JWT Decoder Styles */
.jwt-section {
    margin-bottom: 1.5rem;
}

.jwt-section h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.claims-table {
    background: #f8fafc;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.claim-row {
    display: grid;
    grid-template-columns: 80px 120px 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    align-items: center;
}

.claim-row:last-child {
    border-bottom: none;
}

.claim-key {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.claim-name {
    color: #64748b;
}

.claim-value {
    word-break: break-all;
    font-family: monospace;
}

.success-badge {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}
