/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
    background: #f4f6fa;
    color: #1e293b;
}
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}
.logo {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo i {
    -webkit-text-fill-color: #6366f1;
    margin-right: 8px;
}
.free-badge {
    font-size: 14px;
    background: #e2e8f0;
    padding: 6px 14px;
    border-radius: 20px;
}

/* ===== NAVIGATION ===== */
.main-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px 20px;
    background: white;
    border-radius: 16px;
    margin: 15px 0 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.main-nav a {
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 30px;
    transition: 0.3s;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.main-nav a:hover {
    background: #eef2ff;
    color: #6366f1;
}
.main-nav a i {
    color: #6366f1;
}
.main-nav .nav-active {
    background: #6366f1;
    color: white;
}
.main-nav .nav-active i {
    color: white;
}

/* ===== SECTION TITLES ===== */
.section-title {
    font-size: 22px;
    font-weight: 700;
    margin: 30px 0 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 3px solid #e2e8f0;
}
.section-title i {
    color: #6366f1;
}

/* ===== TOOL CARDS GRID ===== */
.nav-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 10px;
}
@media(min-width:600px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media(min-width:992px) {
    .nav-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
.nav-card {
    background: white;
    padding: 16px 10px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 3px solid transparent;
    transition: 0.3s;
}
.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}
.nav-card i {
    font-size: 28px;
    color: #6366f1;
    margin-bottom: 6px;
    display: block;
}
.nav-card h3 {
    font-size: 14px;
    margin-bottom: 3px;
}
.nav-card p {
    font-size: 11px;
    opacity: 0.7;
}

/* ===== SINGLE TOOL VIEW ===== */
#tool-view {
    background: white;
    padding: 25px;
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    margin-top: 10px;
}
.back-btn {
    background: #eef2ff;
    color: #6366f1;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.back-btn:hover {
    background: #6366f1;
    color: white;
}
#tool-content {
    min-height: 300px;
}

/* ===== TOOL PANELS ===== */
.tool-panel {
    display: block;
    padding: 0;
    background: transparent;
    box-shadow: none;
    margin: 0;
}
.panel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== FORM ELEMENTS ===== */
textarea,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="file"],
input[type="date"],
input[type="datetime-local"],
select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    font-size: 15px;
    background: #f8fafc;
    margin-bottom: 12px;
}
textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: #6366f1;
}
textarea {
    min-height: 100px;
    resize: vertical;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: #6366f1;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
}
.btn-primary:hover {
    background: #4f46e5;
    transform: scale(1.01);
}
.btn-success {
    background: #10b981;
}
.btn-success:hover {
    background: #059669;
}
.btn-warning {
    background: #f59e0b;
}
.btn-warning:hover {
    background: #d97706;
}
.btn-danger {
    background: #ef4444;
}
.btn-danger:hover {
    background: #dc2626;
}

/* ===== OUTPUT BOXES ===== */
.output-box {
    background: #f1f5f9;
    padding: 18px;
    border-radius: 14px;
    margin-top: 15px;
    min-height: 60px;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 2px dashed #cbd5e1;
}
.spinner {
    border: 4px solid #e2e8f0;
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media(max-width:768px) {
    .container {
        padding: 12px;
    }
    #tool-view {
        padding: 15px;
    }
    .logo {
        font-size: 22px;
    }
    .main-nav a {
        font-size: 13px;
        padding: 6px 12px;
    }
    .main-nav {
        gap: 6px;
        padding: 10px;
    }
    .section-title {
        font-size: 18px;
    }
}

.error-msg {
    color: #dc2626;
    font-weight: 600;
}
.success-msg {
    color: #10b981;
    font-weight: 600;
}
.download-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: #10b981;
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
}
.download-link:hover {
    background: #059669;
}
.service-box {
    background: #eef2ff;
    border-left: 6px solid #6366f1;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}
.service-box a {
    color: #6366f1;
    font-weight: 700;
    text-decoration: none;
}
.service-box a:hover {
    text-decoration: underline;
}

/* ===== FOOTER ===== */
.site-footer {
    margin-top: 50px;
    padding: 30px 20px 20px 20px;
    background: white;
    border-radius: 24px;
    border-top: 2px solid #e2e8f0;
    text-align: center;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    max-width: 800px;
    margin: 0 auto 20px auto;
    text-align: left;
}
.footer-grid h4 {
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 16px;
}
.footer-grid a {
    display: block;
    color: #64748b;
    text-decoration: none;
    padding: 4px 0;
    font-size: 14px;
    transition: 0.3s;
}
.footer-grid a:hover {
    color: #6366f1;
}
.footer-bottom {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    color: #94a3b8;
    font-size: 14px;
}
@media(max-width:600px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        text-align: center;
    }
}

/* ===== QR SCANNER ===== */
#qrScannerContainer video {
    width: 100% !important;
    height: auto !important;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
}
#qrScannerContainer {
    margin-bottom: 15px;
}

/* ===== COLOR PREVIEW ===== */
#colorPreview {
    transition: background 0.3s ease;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}