/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Mode Variables */
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --background-start: #667eea;
    --background-end: #764ba2;
    --card-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(255, 255, 255, 0.2);
    --input-bg: #fff;
    --input-border: #ccc;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    /* Dark Mode Variables */
    --text-color: #ecf0f1;
    --background-start: #2c3e50;
    --background-end: #34495e;
    --card-bg: rgba(52, 73, 94, 0.9);
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: #44586d;
    --input-border: #667eea;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2.5rem;
    color: var(--text-color);
}

/* Action Button Base */
.action-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.1s;
    text-decoration: none; /* For the theme toggle link */
}

.action-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

/* Generator Section */
.generator-section, .about-section, .security-tips {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease-out;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    font-size: 1.1rem;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--input-border);
}

.mode-selector label {
    cursor: pointer;
}

/* Settings */
.settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
}

.length-control {
    grid-column: 1 / 3;
    text-align: center;
}

.length-control label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: bold;
}

#length-slider {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    transition: opacity .2s;
}

#length-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.character-options div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-options h3, .custom-words-section h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Custom Words */
.custom-words-section {
    grid-column: 1 / 3;
}

.custom-word-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#custom-word {
    flex-grow: 1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
}

#word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-tag {
    background-color: var(--secondary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.remove-word {
    margin-left: 5px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

/* Password Display */
.password-display {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

#password-output {
    flex-grow: 1;
    padding: 15px;
    font-size: 20px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-color);
    text-align: center;
    font-family: monospace;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-group .action-btn {
    padding: 15px 20px;
    font-size: 1rem;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    margin-bottom: 20px;
    background-color: var(--primary-color); /* Overriding base action-btn if needed */
}

/* Strength Meter */
.strength-meter {
    margin-top: 15px;
    text-align: center;
}

.strength-bar {
    width: 100%;
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
}

#strength-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 5px;
}

#strength-text {
    font-weight: bold;
}

/* Security Tips */
.security-tips h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.security-tips ul {
    list-style-type: disc;
    padding-left: 20px;
}

/* Footer & Theme Toggle */
footer {
    text-align: center;
    padding: 20px 0;
}

#theme-toggle {
    color: var(--text-color);
    text-decoration: underline;
    cursor: pointer;
}

/* About Me Page Styles */
.profile {
    text-align: center;
    margin-bottom: 30px;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 5px solid var(--primary-color);
}

.bio h3, .connect h3 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

.social-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.social-link:hover {
    background-color: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .settings {
        grid-template-columns: 1fr;
    }
    
    .character-options {
        grid-column: 1 / 2; /* Ensure it stays in the single column layout */
    }

    .custom-words-section {
        grid-column: 1 / 2;
    }

    .custom-word-input {
        flex-direction: column;
    }

    .generator-section {
        padding: 20px;
    }

    .password-display {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-group {
        width: 100%;
    }

    .btn-group .action-btn {
        flex-grow: 1;
    }

    .mode-selector {
        flex-direction: column;
        gap: 10px;
    }

    .social-links {
        flex-direction: column;
        align-items: center;
    }

    .social-link {
        width: 100%;
        justify-content: center;
        max-width: 250px; /* Cap width on small screens */
    }

    .about-section {
        padding: 25px;
    }

    .profile-image {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    .generate-btn {
        font-size: 16px;
    }

    .security-tips {
        padding: 15px;
    }

    #password-output {
        font-size: 16px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}