/* Modern CodeSnap Design */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    transition: background-color 0.3s ease;
}

body.dark-mode {
    background-color: #1a1a1a;
    color: #f5f5f5;
}

/* Header */
.header {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header.dark-mode {
    background-color: #2d2d2d;
    border-bottom-color: #404040;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.dark-mode .logo h1 {
    color: #f5f5f5;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: #f0f0f0;
    color: #333;
}

.dark-mode .theme-toggle {
    color: #ccc;
}

.dark-mode .theme-toggle:hover {
    background-color: #404040;
    color: #f5f5f5;
}

.github-link {
    color: #666;
    font-size: 1.2rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.github-link:hover {
    color: #333;
}

.dark-mode .github-link {
    color: #ccc;
}

.dark-mode .github-link:hover {
    color: #f5f5f5;
}

.header-link {
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.header-link:hover {
    color: #007bff;
}

.dark-mode .header-link {
    color: #ccc;
}

.dark-mode .header-link:hover {
    color: #66b3ff;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Cards */
.card {
    background-color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.dark-mode .card {
    background-color: #2d2d2d;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.card:hover {
    box-shadow: 0 8px 12px rgba(0,0,0,0.15);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.dark-mode .card-title {
    color: #f5f5f5;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.dark-mode .form-group label {
    color: #ccc;
}

.form-select,
.form-input,
.code-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.dark-mode .form-select,
.dark-mode .form-input,
.dark-mode .code-textarea {
    background-color: #404040;
    border-color: #555;
    color: #f5f5f5;
}

.form-select:focus,
.form-input:focus,
.code-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.code-textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    min-height: 200px;
}

/* Submit Button */
.submit-btn {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.submit-btn:hover {
    background-color: #0056b3;
}

.submit-btn:active {
    transform: translateY(1px);
}

/* Slider Styles */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.dark-mode .slider {
    background: #555;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 60px;
    text-align: right;
    font-weight: 500;
    color: #666;
}

.dark-mode .slider-value {
    color: #ccc;
}

/* Radio and Checkbox Styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Preview Section */
.preview-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: auto;
}

.dark-mode .preview-container {
    background-color: #1a1a1a;
}

.preview-status {
    min-height: 1.25rem;
    margin-bottom: 0.75rem;
    color: #666;
    font-size: 0.85rem;
}

.dark-mode .preview-status {
    color: #ccc;
}

.code-preview {
    background-color: #282a36;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #3c3e4a;
    border-bottom: 1px solid #4a4d5a;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.control-red { background-color: #ff5f56; }
.control-yellow { background-color: #ffbd2e; }
.control-green { background-color: #27ca3f; }

.filename {
    font-size: 0.8rem;
    color: #f8f8f2;
    font-weight: 500;
}

.code-content {
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.export-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn {
    background-color: #007bff;
    color: #fff;
}

.download-btn:hover {
    background-color: #0056b3;
}

.copy-btn {
    background-color: #28a745;
    color: #fff;
}

.copy-btn:hover {
    background-color: #1e7e34;
}

.neutral-btn {
    background-color: #6c757d;
    color: #fff;
}

.neutral-btn:hover {
    background-color: #555f66;
}

/* Image Base64 Tool */
.tool-section {
    padding: 1rem 0 3rem;
}

.tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.tool-heading {
    margin-bottom: 1.5rem;
}

.tool-heading h2 {
    color: #333;
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.dark-mode .tool-heading h2 {
    color: #f5f5f5;
}

.tool-heading p {
    color: #666;
    max-width: 680px;
}

.dark-mode .tool-heading p {
    color: #ccc;
}

.eyebrow {
    color: #007bff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.dark-mode .eyebrow {
    color: #66b3ff;
}

.base64-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.base64-card {
    height: 100%;
}

.base64-textarea {
    min-height: 160px;
    overflow-wrap: anywhere;
}

.base64-preview-shell {
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef2f7 100%);
    border: 1px dashed #ccd4df;
    border-radius: 10px;
    color: #777;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    min-height: 180px;
    overflow: hidden;
    padding: 1rem;
    text-align: center;
}

.dark-mode .base64-preview-shell {
    background: linear-gradient(135deg, #202020 0%, #303030 100%);
    border-color: #555;
    color: #bbb;
}

.base64-preview-shell.has-image {
    background: #f8f9fa;
    border-style: solid;
}

.dark-mode .base64-preview-shell.has-image {
    background: #1a1a1a;
}

.base64-preview-shell.has-image .base64-placeholder {
    display: none;
}

.base64-preview-image {
    border-radius: 8px;
    max-height: 280px;
    max-width: 100%;
    object-fit: contain;
}

.base64-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.base64-actions .submit-btn,
.base64-actions .export-btn {
    margin-top: 0;
}

.disabled-link {
    opacity: 0.55;
    pointer-events: none;
}

/* JSON Formatter Tool */
.json-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.json-card {
    height: 100%;
}

.json-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.json-toolbar .submit-btn,
.json-toolbar .export-btn {
    margin-top: 0;
}

.json-config {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.json-config label,
.json-config-check {
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
}

.dark-mode .json-config label,
.dark-mode .json-config-check {
    color: #ccc;
}

.json-config-select {
    min-width: 120px;
    padding: 0.55rem 0.75rem;
}

.json-config-check {
    align-items: center;
    display: flex;
    gap: 0.4rem;
}

.json-textarea {
    min-height: 420px;
    tab-size: 2;
    white-space: pre;
}

.json-output {
    background-color: #f8f9fa;
}

.dark-mode .json-output {
    background-color: #1f1f1f;
}

.json-meta {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.dark-mode .json-meta {
    color: #ccc;
}

.json-status-error {
    color: #b00020;
}

.dark-mode .json-status-error {
    color: #ff8a9a;
}

.json-status-success {
    color: #1e7e34;
}

.dark-mode .json-status-success {
    color: #78d68b;
}

/* QR Decoder Tool */
.qr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.qr-card {
    height: 100%;
}

.qr-privacy-note {
    background: #eef5ff;
    border: 1px solid #d8e8ff;
    border-radius: 8px;
    color: #234b74;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

.dark-mode .qr-privacy-note {
    background: #203247;
    border-color: #315072;
    color: #c7e1ff;
}

.qr-drop-zone {
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef2f7 100%);
    border: 1px dashed #ccd4df;
    border-radius: 10px;
    color: #777;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    min-height: 240px;
    overflow: hidden;
    padding: 1rem;
    text-align: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dark-mode .qr-drop-zone {
    background: linear-gradient(135deg, #202020 0%, #303030 100%);
    border-color: #555;
    color: #bbb;
}

.qr-drop-zone.is-dragging {
    border-color: #007bff;
    background: #eef5ff;
}

.dark-mode .qr-drop-zone.is-dragging {
    background: #203247;
    border-color: #66b3ff;
}

.qr-drop-zone.has-image {
    background: #f8f9fa;
    border-style: solid;
}

.dark-mode .qr-drop-zone.has-image {
    background: #1a1a1a;
}

.qr-drop-zone.has-image .qr-drop-zone-text {
    display: none;
}

.qr-preview-image {
    border-radius: 8px;
    max-height: 340px;
    max-width: 100%;
    object-fit: contain;
}

.qr-result-textarea {
    min-height: 280px;
    overflow-wrap: anywhere;
}

.qr-paste-hint {
    color: #666;
    font-size: 0.85rem;
    margin: -0.35rem 0 1rem;
}

.dark-mode .qr-paste-hint {
    color: #ccc;
}

.qr-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.qr-actions .submit-btn,
.qr-actions .export-btn {
    margin-top: 0;
}

/* SEO Content */
.seo-section {
    padding: 0 0 3rem;
}

.seo-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 2rem;
}

.dark-mode .seo-card {
    background: #2d2d2d;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.seo-card h2 {
    color: #333;
    font-size: 1.8rem;
    line-height: 1.25;
    margin-bottom: 1rem;
}

.dark-mode .seo-card h2 {
    color: #f5f5f5;
}

.seo-card p {
    color: #555;
    margin-bottom: 1rem;
    max-width: 900px;
}

.dark-mode .seo-card p {
    color: #ccc;
}

.seo-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.seo-keywords span {
    background: #eef5ff;
    border: 1px solid #d8e8ff;
    border-radius: 999px;
    color: #0056b3;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
}

.dark-mode .seo-keywords span {
    background: #203247;
    border-color: #315072;
    color: #9dccff;
}

/* Footer */
.footer {
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 1.5rem 0;
    position: relative;
}

.dark-mode .footer {
    background-color: #2d2d2d;
    border-top-color: #404040;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left p {
    color: #666;
    font-size: 0.9rem;
}

.dark-mode .footer-left p {
    color: #ccc;
}

.footer-right {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #333;
}

.dark-mode .footer-link {
    color: #ccc;
}

.dark-mode .footer-link:hover {
    color: #f5f5f5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .header-content,
    .footer-content {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .card {
        padding: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header-controls {
        gap: 0.65rem;
    }

    .header-link {
        font-size: 0.82rem;
    }

    .tool-container {
        padding: 0 1rem;
    }

    .base64-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .json-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .qr-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .json-textarea {
        min-height: 300px;
    }

    .json-config {
        width: 100%;
    }

    .json-config-select {
        flex: 1;
    }

    .seo-card {
        padding: 1.25rem;
    }

    .seo-card h2 {
        font-size: 1.45rem;
    }
}

/* Canvas Controls */
.canvas-controls {
    margin-top: 1rem;
}

.canvas-controls label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.dark-mode .canvas-controls label {
    color: #ccc;
}
