/* ========================================
   DevToolkit V2
   ======================================== */

:root {
    --bg: #0f0f0f;
    --bg-surface: #1a1a1a;
    --bg-card: #222;
    --bg-hover: #2a2a2a;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --text: #fff;
    --text-secondary: #888;
    --border: #333;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Background */
.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(245, 158, 11, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(249, 115, 22, 0.08), transparent);
    pointer-events: none;
    z-index: 0;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 15, 15, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    text-decoration: none;
    color: var(--text);
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 6px 12px;
    border-radius: 20px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 60px 24px 40px;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Main */
.main {
    position: relative;
    z-index: 1;
    padding: 0 24px 80px;
}

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

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

/* Tool Card */
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.tool-card:hover {
    background: var(--bg-hover);
    border-color: rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.tool-card-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.tool-card-icon svg {
    color: var(--accent);
    width: 20px;
    height: 20px;
}

.tool-card:hover .tool-card-icon {
    background: var(--accent);
}

.tool-card:hover .tool-card-icon svg {
    color: #000;
}

.tool-card-content {
    flex: 1;
    min-width: 0;
}

.tool-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.tool-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #dc2626;
    color: white;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

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

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.form-textarea.readonly {
    background: var(--bg-hover);
    cursor: default;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* Options */
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 16px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.option-item input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: monospace;
}

/* Color Preview */
.color-preview-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 16px;
}

.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.color-values {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-value {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-value span {
    width: 40px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.color-value code {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8rem;
    cursor: pointer;
}

.color-value code:hover {
    background: var(--bg-hover);
}

/* Strength Meter */
.strength-meter {
    display: flex;
    gap: 4px;
    margin: 12px 0;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.strength-bar.active.weak { background: #dc2626; }
.strength-bar.active.medium { background: #f97316; }
.strength-bar.active.strong { background: var(--accent); }

.strength-label {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.strength-label.weak { color: #dc2626; }
.strength-label.medium { color: #f97316; }
.strength-label.strong { color: var(--accent); }

/* Regex */
.regex-matches {
    max-height: 150px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.match-item {
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.match-item:last-child {
    margin-bottom: 0;
}

.match-text {
    color: var(--accent);
}

.match-index {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    animation: toastIn 0.2s ease;
}

.toast.success {
    border-color: var(--accent);
}

.toast.error {
    border-color: #dc2626;
}

/* Responsive */
@media (max-width: 600px) {
    .tagline {
        display: none;
    }

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

    .hero {
        padding: 40px 20px 30px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .modal-container {
        max-height: 90vh;
    }

    .color-preview-container {
        flex-direction: column;
    }
}

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