/* /tools/global-tools.css */

:root {
    --primary: #111827;
    --accent: #007bff;
    --bg: #f4f7f6;
    --sidebar-width: 260px;
    --text-main: #111827;
    --text-muted: #6b7280;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    display: flex;
    margin: 0;
    min-height: 100vh;
}

/* Layout Shell */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 60px 20px;
    display: flex;
    justify-content: center;
}

.tool-wrapper {
    width: 100%;
    max-width: 850px;
}

.tool-header {
    margin-bottom: 30px;
}

.tool-header h1 {
    margin: 0 0 10px 0;
    color: var(--primary);
    font-size: 1.8rem;
}

.tool-header p {
    color: var(--text-muted);
    margin: 0;
}

/* Common Components */
.card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

input[type="text"], 
input[type="number"], 
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #fff;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #000;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
}

/* 404 Specific Styling */
.error-container {
    text-align: center;
    padding: 60px 20px;
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    color: #e5e7eb; /* Subtle light gray */
    margin: 0;
    line-height: 1;
}

.error-container h1 {
    margin-top: -10px;
    font-size: 2rem;
}

/* Spinner & Overlay Styles */
#overlay {
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.9); 
    z-index: 9999;
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
}

.spinner {
    width: 50px; height: 50px; 
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary); 
    border-radius: 50%;
    animation: spin 1s linear infinite; 
    margin-bottom: 20px;
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* Tool Specific Sub-sections (like Image Options) */
.sub-section { 
    background: #f9f9f9; 
    padding: 20px; 
    border-radius: 10px; 
    margin-top: 20px; 
    border: 1px solid #eee; 
}

/* Result Preview Area */
#result-container { 
    display: none; 
    margin-top: 40px; 
    padding-top: 30px; 
    border-top: 2px solid #eee; 
    text-align: center; 
}

#output-image { 
    max-width: 100%; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}

.download-btn { 
    display: inline-block; 
    margin-top: 20px; 
    padding: 12px 25px; 
    background: var(--accent); 
    color: white; 
    text-decoration: none; 
    border-radius: 6px; 
    font-weight: bold; 
}

/* Editor & Textarea Components */
.editor-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

textarea {
    width: 100%;
    height: 350px; /* Standardized height for utility editors */
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    background-color: #fafafa;
    color: #1f2937;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    background-color: #fff;
}

/* Status Bar & Controls */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 0 5px;
    color: var(--text-muted);
}

.error-msg {
    color: #ef4444;
    font-weight: 600;
    visibility: hidden; /* Hidden by default via JS */
}

.controls {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr; /* Center button is more prominent */
    gap: 10px;
    margin-top: 10px;
}

.btn {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn:hover {
    background: #f3f4f6;
}

/* Re-use btn-primary from global for the main action */

/* Standardized Button & Control Group */
.controls {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

/* Base button style for ALL buttons in tools */
.btn {
    flex: 1; /* Makes buttons equal width */
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #d1d5db;
    background-color: white;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

/* Primary Button Override (Matches your black/dark navy theme) */
.btn-primary {
    background-color: var(--primary) !important;
    color: white !important;
    border: none !important;
}

.btn-primary:hover {
    background-color: #000 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Secondary/Action buttons usually need a bit more emphasis than plain white */
#copyBtn {
    background-color: #f3f4f6;
}

/* File Upload & Zone Styles */
.upload-zone {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone:hover, .upload-zone.dragover { 
    border-color: var(--accent); 
    background: #f0f7ff; 
}

.file-info {
    margin-top: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #eee;
    font-size: 0.85rem;
}

/* Status Messaging */
.status {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}
.status.success { background: #dcfce7; color: #166534; }
.status.error { background: #fee2e2; color: #991b1b; }

/* Code/JSON Preview Area */
.preview-box {
    margin-top: 20px;
    background: #1e293b;
    color: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Progress Bar Styles */
.progress-container {
    display: none;
    width: 100%;
    background-color: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--accent);
    transition: width 0.2s ease;
}

/* /tools/global-tools.css additions */

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.05); /* Assumes you have primary-rgb defined */
}

.upload-zone:hover { 
    border-color: var(--text-main); 
    background: #ffffff; 
}

.preview-pane {
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.code-output {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    color: #334155;
    max-height: 200px;
    overflow-y: auto;
    word-break: break-all;
    margin-top: 12px;
    line-height: 1.4;
}

.action-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.stats-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    float: right;
}