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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --success: #10b981;
    --border-color: #475569;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1a1f35 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    border-radius: 20px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.6s ease-in;
}

.browser-tabs-visual {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 16px;
    border: 2px solid var(--primary-color);
    animation: slideDown 0.6s ease-in;
    max-width: 100%;
    overflow-x: auto;
}

.browser-tabs-visual svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.header-content {
    position: relative;
}

.title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-tab {
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.nav-tab:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.nav-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.tab-icon {
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    margin-bottom: 40px;
    flex: 1;
}

.tool-section {
    display: none;
    animation: fadeIn 0.4s ease-in;
}

.tool-section.active {
    display: block;
}

.calculator-section {
    display: none;
}

.calculator-section.active {
    display: block;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
    transform: translateY(-5px);
}

.card-header {
    padding: 25px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.input-field,
.input-field select {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-field:focus,
.input-field:focus-visible,
.input-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: rgba(99, 102, 241, 0.05);
}

.input-field::placeholder {
    color: var(--text-secondary);
}

.input-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M1 4l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.input-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

.output-field {
    padding: 15px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    word-break: break-all;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Radio Group */
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Slider */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-light);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    accent-color: var(--primary-color);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* QR Container */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    min-height: 320px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    padding: 20px;
}

.qr-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    min-width: 280px;
}

.qr-box canvas {
    width: 100%;
    height: 100%;
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.color-item {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
}

.color-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    border-color: var(--primary-color);
}

.color-box {
    width: 100%;
    height: 80px;
    border-radius: 8px 8px 0 0;
}

.color-code {
    padding: 10px;
    background: var(--surface-light);
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

/* Username List */
#usernameList {
    max-height: 350px;
    overflow-y: auto;
}

.username-item {
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.username-text {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    word-break: break-all;
}

.username-copy {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.username-copy:hover {
    background: var(--primary-dark);
}

/* Password Storage */
#passwordStorage {
    max-height: 400px;
    overflow-y: auto;
}

.password-item {
    padding: 15px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.password-item-content {
    flex: 1;
    min-width: 0;
}

.password-item-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.password-item-value {
    color: var(--text-secondary);
    font-size: 0.85rem;
    word-break: break-all;
    font-family: 'Courier New', monospace;
}

.password-item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.password-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.password-btn-copy {
    background: var(--primary-color);
    color: white;
}

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

.password-btn-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.password-btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Color Storage */
#colorStorage {
    max-height: 400px;
    overflow-y: auto;
}

.color-palette-item {
    padding: 15px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.color-palette-preview {
    display: flex;
    gap: 8px;
    flex: 1;
}

.color-palette-box {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-palette-box:hover {
    transform: scale(1.05);
}

.color-palette-name {
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
}

.color-palette-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.color-palette-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.color-palette-btn-copy {
    background: var(--primary-color);
    color: white;
}

.color-palette-btn-copy:hover {
    background: var(--primary-dark);
}

.color-palette-btn-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.color-palette-btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary {
    background: rgba(236, 72, 153, 0.2);
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-secondary:hover {
    background: rgba(236, 72, 153, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    border: 2px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    width: auto;
}

.btn-small:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

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

.btn-icon {
    font-size: 1.2rem;
}

/* Strength Bars */
.strength-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.strength-bar.weak {
    background: #ef4444;
}

.strength-bar.medium {
    background: #f59e0b;
}

.strength-bar.strong {
    background: var(--success);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.card {
    animation: fadeIn 0.6s ease-in;
}

/* Success Message */
.success-message {
    color: var(--success);
    font-size: 0.9rem;
    margin-top: 10px;
    animation: fadeIn 0.3s ease;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .nav-tabs {
        gap: 8px;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .nav-tab {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 20px;
    }

    .qr-container {
        min-height: 250px;
    }

    .qr-box {
        min-height: 220px;
        min-width: 220px;
    }

    .header {
        padding: 30px 15px;
        margin-bottom: 20px;
    }

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

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .nav-tabs {
        gap: 6px;
        margin-bottom: 20px;
    }

    .nav-tab {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .tab-icon {
        font-size: 1rem;
    }

    .card-header h2 {
        font-size: 1.2rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .color-palette {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
    }
}

/* Image Editor */
.image-editor-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    background: var(--surface-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
}

.image-editor-container:active {
    cursor: grabbing;
}

.image-editor-canvas {
    width: 100%;
    height: 100%;
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.crop-guide {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border: 2px dashed var(--primary-color);
    pointer-events: none;
    box-shadow: inset 0 0 0 10000px rgba(0, 0, 0, 0.3);
}

.preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 200px;
    height: 200px;
    background: var(--surface-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 768px) {
    .image-editor-container {
        max-width: 100%;
    }

    .preview-container {
        width: 120px;
        height: 120px;
    }
}
