@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap');

:root {
    --primary: #0f6dff;
    --primary-dark: #0a4ec7;
    --secondary: #0f9d82;
    --accent: #ff9f43;
    --dark: #162033;
    --light: #f4f8ff;
    --gray: #5a6579;
    --white: #ffffff;
    --border: #dbe4f4;
    --shadow: 0 10px 30px rgba(22, 32, 51, 0.08);
    --shadow-lg: 0 20px 45px rgba(15, 109, 255, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Manrope', sans-serif;
}

body {
    background:
        radial-gradient(circle at 10% -5%, rgba(15, 109, 255, 0.15), transparent 35%),
        radial-gradient(circle at 90% 0%, rgba(15, 157, 130, 0.16), transparent 28%),
        linear-gradient(180deg, #eef4ff 0%, #f7fbff 48%, #f2f7ff 100%);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 8px 26px rgba(22, 32, 51, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--primary);
}

.logo i {
    font-size: 1.8rem;
}

nav {
    display: flex;
    gap: 10px;
}

.nav-link {
    text-decoration: none;
    color: var(--gray);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    background: linear-gradient(120deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: 0 8px 20px rgba(15, 109, 255, 0.2);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 70px 20px 58px;
}

.hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 15px;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.08rem;
    color: var(--gray);
    max-width: 760px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding-bottom: 60px;
}

.tool-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: fadeUp 0.42s ease both;
}

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

.tool-card.hidden {
    display: none;
}

.tool-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.tool-icon i {
    font-size: 1.5rem;
    color: var(--white);
}

.tool-card h3 {
    font-size: 1.18rem;
    margin-bottom: 10px;
    color: var(--dark);
    letter-spacing: -0.01em;
}

.tool-card p {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.tool-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    padding: 5px;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--dark);
}

.modal-body {
    padding: 30px;
}

/* Tool Forms */
.tool-section {
    margin-bottom: 25px;
}

.tool-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.tool-section input[type="text"],
.tool-section input[type="number"],
.tool-section input[type="url"],
.tool-section textarea,
.tool-section select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.tool-section input:focus,
.tool-section textarea:focus,
.tool-section select:focus {
    outline: none;
    border-color: var(--primary);
}

.tool-section textarea {
    min-height: 150px;
    font-family: 'Courier New', monospace;
}

.drop-zone {
    border: 2px dashed #c7d6ee;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(15, 109, 255, 0.06);
}

.drop-zone i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 15px;
}

.drop-zone p {
    color: var(--gray);
}

.drop-zone .browse-btn {
    color: var(--primary);
    font-weight: 600;
}

.preview-area {
    margin-top: 20px;
    text-align: center;
}

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

.preview-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: 10px;
}

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

.btn-primary {
    background: linear-gradient(125deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.btn-primary:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(125deg, var(--secondary), #0b7f69);
    color: var(--white);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.btn-secondary:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--dark);
    border: 2px solid #e5e7eb;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.studio-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.studio-action-btn.active {
    border-color: var(--primary);
    color: var(--white);
    background: linear-gradient(125deg, var(--primary), var(--primary-dark));
}

.studio-panel {
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 12px;
    background: #fbfdff;
}

/* Format Options */
.format-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.format-btn {
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

/* Rotation Buttons */
.rotate-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.rotate-btn {
    padding: 12px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rotate-btn:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

/* Color Picker */
.color-picker-area {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.color-preview {
    width: 150px;
    height: 150px;
    border-radius: 12px;
    border: 3px solid #e5e7eb;
}

.color-values {
    flex: 1;
    min-width: 200px;
}

.color-value {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--light);
    border-radius: 8px;
}

.color-value input {
    flex: 1;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.copy-btn {
    padding: 8px 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Unit Converter */
.unit-categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.unit-cat-btn {
    padding: 10px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-weight: 500;
}

.unit-cat-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

.unit-converter-area {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.unit-converter-area input,
.unit-converter-area select {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
}

/* QR Code */
.qr-result {
    margin-top: 20px;
    text-align: center;
}

.qr-result canvas {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.global-ad-wrap {
    margin: 24px auto 32px;
    max-width: 980px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

.ad-label {
    margin: 0 0 8px;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--gray);
    text-transform: uppercase;
}

.ad-slot {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-size: 0.9rem;
    text-align: center;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #13223c, #0d376e);
    color: var(--white);
    padding: 30px 0;
    margin-top: auto;
    text-align: center;
}

footer p {
    opacity: 0.8;
}

/* Hidden file input */
#fileInput {
    display: none;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success message */
.success-msg {
    background: #d1fae5;
    color: #065f46;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

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

    .modal-content {
        margin: 10px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }
}

/* Tool Page Styles */
.tool-page {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    padding: 40px;
    margin: 40px 0;
    box-shadow: var(--shadow);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-page h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--dark);
}

.tool-description {
    color: var(--gray);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.tool-info {
    margin-top: 30px;
    padding: 20px;
    background: var(--light);
    border-radius: 12px;
}

.tool-info h3 {
    margin-bottom: 15px;
    color: var(--dark);
}

.tool-info ol {
    padding-left: 20px;
    color: var(--gray);
}

.tool-info li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.breadcrumb {
    padding: 15px 0;
    color: var(--gray);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.related-tools {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e7eb;
}

.related-tools h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.related-tool-card {
    background: var(--light);
    padding: 15px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s ease;
}

.related-tool-card:hover {
    background: var(--primary);
    color: var(--white);
}

.related-tool-card i {
    margin-right: 8px;
}
