/* Base Styles */
:root {
    --background: #ffffff;
    --foreground: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-bg-solid: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --primary-btn: linear-gradient(to right, #8b5cf6, #7c3aed);
    --primary-btn-hover: linear-gradient(to right, #7c3aed, #6d28d9);
    --pink-btn: linear-gradient(to right, #ec4899, #db2777);
    --pink-btn-hover: linear-gradient(to right, #db2777, #be185d);
    --outline-btn: #f1f5f9;
    --outline-btn-hover: #e2e8f0;
    --outline-btn-text: #0f172a;
    --tab-active: #f1f5f9;
    --tab-inactive: #e2e8f0;
    --progress-bg: #e2e8f0;
    --progress-weak: #ef4444;
    --progress-moderate: #f59e0b;
    --progress-strong: #10b981;
    --progress-very-strong: #059669;
    --text-muted: #64748b;
    --history-item-bg: #f8fafc;
    --history-item-hover: #f1f5f9;
    --page-gradient: linear-gradient(to bottom right, #f9a8d4, #c7d2fe, #bfdbfe);
    --category-bg: #f1f5f9;
    --category-hover: #e2e8f0;
    --category-active: #dbeafe;
    --category-active-border: #3b82f6;
}

.dark {
    --background: #0f172a;
    --foreground: #f8fafc;
    --card-bg: rgba(15, 23, 42, 0.8);
    --card-bg-solid: #1e293b;
    --card-border: #334155;
    --input-bg: #1e293b;
    --input-border: #475569;
    --primary-btn: linear-gradient(to right, #8b5cf6, #7c3aed);
    --primary-btn-hover: linear-gradient(to right, #7c3aed, #6d28d9);
    --pink-btn: linear-gradient(to right, #ec4899, #db2777);
    --pink-btn-hover: linear-gradient(to right, #db2777, #be185d);
    --outline-btn: #334155;
    --outline-btn-hover: #475569;
    --outline-btn-text: #f8fafc;
    --tab-active: #1e293b;
    --tab-inactive: #0f172a;
    --progress-bg: #334155;
    --progress-weak: #ef4444;
    --progress-moderate: #f59e0b;
    --progress-strong: #10b981;
    --progress-very-strong: #059669;
    --text-muted: #94a3b8;
    --history-item-bg: #1e293b;
    --history-item-hover: #334155;
    --page-gradient: linear-gradient(to bottom right, #4c1d95, #1e3a8a, #0c4a6e);
    --category-bg: #1e293b;
    --category-hover: #334155;
    --category-active: #1e40af;
    --category-active-border: #60a5fa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background: var(--page-gradient);
    color: var(--foreground);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(to right, #ec4899, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
}

.theme-toggle-checkbox {
    opacity: 0;
    position: absolute;
}

.theme-toggle-label {
    background-color: #334155;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    height: 26px;
    width: 50px;
    transform: scale(1.2);
}

.theme-toggle-label .fa-sun {
    color: #f59e0b;
    font-size: 14px;
}

.theme-toggle-label .fa-moon {
    color: #f1f5f9;
    font-size: 14px;
}

.theme-toggle-label .ball {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 22px;
    width: 22px;
    transform: translateX(0px);
    transition: transform 0.2s linear;
}

.theme-toggle-checkbox:checked + .theme-toggle-label .ball {
    transform: translateX(24px);
}

/* Card Styles */
.card {
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s;
}

/* Tabs */
.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background-color: var(--tab-inactive);
    padding: 0.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem;
    border: none;
    background-color: transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--foreground);
    transition: background-color 0.2s;
}

.tab-btn.active {
    background-color: var(--tab-active);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Form Elements */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 1rem;
    font-weight: 500;
}

.form-input {
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--foreground);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.form-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--progress-bg);
    outline: none;
    margin: 0.5rem 0;
}

.form-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
}

.form-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    border: none;
}

.color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-preview {
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    border: 1px solid var(--input-border);
}

.form-color {
    -webkit-appearance: none;
    width: 100%;
    height: 2.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    cursor: pointer;
}

.form-color::-webkit-color-swatch {
    border: none;
    border-radius: 0.25rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    cursor: pointer;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-btn);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-btn-hover);
}

.btn-pink {
    background: var(--pink-btn);
}

.btn-pink:hover {
    background: var(--pink-btn-hover);
}

.btn-outline {
    background-color: var(--outline-btn);
    color: var(--outline-btn-text);
    border: 1px solid var(--input-border);
}

.btn-outline:hover {
    background-color: var(--outline-btn-hover);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
    background-color: var(--outline-btn);
    color: var(--outline-btn-text);
}

.btn-full:hover {
    background-color: var(--outline-btn-hover);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.btn-clear {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-clear:hover {
    color: #dc2626;
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.preview-container {
    background-color: var(--history-item-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.placeholder-text {
    color: var(--text-muted);
}

.small-text {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Password Display */
.password-preview-container {
    background-color: var(--history-item-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
}

.password-field-container {
    position: relative;
}

.password-display {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    text-align: center;
    border-radius: 0.375rem;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--foreground);
}

.toggle-visibility {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.125rem;
}

.toggle-visibility:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Strength Meter */
.strength-meter-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.strength-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.strength-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.strength-percentage {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 0.5rem;
    background-color: var(--progress-bg);
    border-radius: 0.25rem;
    overflow: hidden;
}

.progress-indicator {
    height: 100%;
    width: 0%;
    transition: width 0.3s, background-color 0.3s;
}

/* History Section */
.history-card {
    background-color: var(--card-bg-solid);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.history-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.history-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.empty-history {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--history-item-bg);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-item:hover {
    background-color: var(--history-item-hover);
}

.history-color-preview {
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    border: 1px solid var(--input-border);
    position: relative;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-text {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.history-timestamp {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.history-badge {
    background-color: var(--category-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.history-actions {
    display: flex;
    gap: 0.25rem;
}

.history-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.history-btn:hover {
    background-color: var(--category-bg);
}

/* Export/Import Section */
.export-import-section {
    background-color: var(--card-bg-solid);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border);
}

.export-import-section h3 {
    margin-bottom: 1rem;
}

/* Password Requirements */
.requirements-details {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: var(--history-item-bg);
    border-radius: 0.375rem;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.requirement:last-child {
    margin-bottom: 0;
}

.req-icon {
    color: var(--text-muted);
}

.req-icon.active {
    color: var(--progress-strong);
}

/* Categories Section */
.categories-section {
    background-color: var(--card-bg-solid);
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--card-border);
}

.categories-section h3 {
    margin-bottom: 1rem;
}

.categories-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: var(--category-bg);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.category-item:hover {
    background-color: var(--category-hover);
}

.category-item.active {
    background-color: var(--category-active);
    border-color: var(--category-active-border);
}

.category-item i {
    font-size: 1.5rem;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .title {
        font-size: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .categories-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .button-group {
        flex-direction: column;
    }

    .color-grid {
        grid-template-columns: 1fr;
    }
}