/* --- 1. Global Setup & Resets --- */
:root {
    --color-bg: #0a0a1a;
    --color-text: #e0e0e0;
    --color-primary-neon: #00ff99;
    --color-secondary-neon: #00ccff;
    --color-weak: #ff4b2b;
    --color-medium: #ffaf00;
    --color-strong: #00c9ff;
    --color-very-strong: #00ff99;
    --color-glass-bg: rgba(10, 20, 40, 0.25);
    --color-glass-border: rgba(0, 255, 153, 0.2);
    --border-radius: 15px;
    --font-family: 'Poppins', sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    position: relative;
}

/* Animated grid background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background:
        linear-gradient(rgba(0, 204, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 204, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: pulse-grid 10s linear infinite;
}

@keyframes pulse-grid {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* --- 2. Typography & Links --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow:
        0 0 5px var(--color-secondary-neon),
        0 0 10px var(--color-secondary-neon);
}

h1 {
    font-size: 3rem;
    color: var(--color-primary-neon);
    text-shadow:
        0 0 10px var(--color-primary-neon),
        0 0 20px var(--color-primary-neon),
        0 0 40px var(--color-primary-neon);
}

h2 { font-size: 2.2rem; }
h3 { font-size: 1.5rem; }
p { line-height: 1.7; margin-bottom: 1rem; }
a { color: var(--color-primary-neon); text-decoration: none; }

/* --- 3. Page Structure (Nav, Hero, Sections, Footer) --- */
.container {
    width: 90%;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 0;
}

nav {
    width: 100%;
    padding: 1.5rem 5%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: rgba(10, 10, 26, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary-neon);
    text-shadow: 0 0 10px var(--color-primary-neon);
}

.nav-links a {
    margin-left: 2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--color-primary-neon);
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
    padding: 10rem 1rem 4rem 1rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 600px;
    opacity: 0.9;
}

footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--color-glass-border);
    color: #888;
}

.social-links a {
    font-size: 1.5rem;
    margin: 0 1rem;
    color: #888;
    transition: all 0.3s ease;
}
.social-links a:hover {
    color: var(--color-primary-neon);
    text-shadow: 0 0 10px var(--color-primary-neon);
}

/* --- 4. Core App: Glass Card & Components --- */
.glass-card {
    background: var(--color-glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    animation: fadeIn 1s ease-out;
    transition: all 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 0 20px rgba(0, 255, 153, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

#password-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-secondary-neon);
    border-radius: 8px;
    padding: 0.8rem 3.5rem 0.8rem 1rem;
    color: var(--color-text);
    font-size: 1.1rem;
    font-family: var(--font-family);
    transition: all 0.3s ease;
}

#password-input:focus {
    outline: none;
    border-color: var(--color-primary-neon);
    box-shadow: 0 0 15px var(--color-secondary-neon);
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-icon:hover {
    color: var(--color-secondary-neon);
}

#copy-icon {
    right: 3.5rem;
}

/* Strength Meter */
.strength-meter {
    width: 100%;
    height: 25px;
    background: #1a1a3a;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 204, 255, 0.2);
}

#strength-bar {
    height: 100%;
    width: 0%;
    transition: width 0.5s ease-out, background 0.5s ease-out;
}

#strength-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Strength level classes */
.strength-bar-weak { background: linear-gradient(90deg, #ff416c, var(--color-weak)); }
.strength-bar-medium { background: linear-gradient(90deg, #ff8c00, var(--color-medium)); }
.strength-bar-strong { background: linear-gradient(90deg, #00c9ff, var(--color-strong)); }
.strength-bar-very-strong { background: linear-gradient(90deg, #00ffc6, var(--color-very-strong)); }

.score-display {
    text-align: right;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

#score-value {
    color: var(--color-secondary-neon);
    font-size: 1.3rem;
}

/* Suggestions List */
.suggestions-list {
    list-style: none;
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.suggestion-item.met {
    color: #888;
}

.suggestion-item i {
    margin-right: 0.75rem;
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.suggestion-item .fa-check-circle {
    color: var(--color-very-strong);
}

.suggestion-item .fa-times-circle {
    color: var(--color-weak);
}

/* --- 5. Password Generator --- */
.generator {
    margin-top: 2rem;
    border-top: 1px solid var(--color-glass-border);
    padding-top: 2rem;
}

.generator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.generator-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

/* Custom Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.switch input { display: none; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--color-primary-neon);
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* Length Slider */
.length-slider {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1; /* Span full width */
}

.length-slider .header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

#length-value {
    color: var(--color-primary-neon);
    font-weight: 600;
}

#length-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}
#length-slider:hover { opacity: 1; }
#length-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-primary-neon);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color-primary-neon);
}
#length-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--color-primary-neon);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color-primary-neon);
}

/* --- 6. Buttons & Modals --- */
.btn {
    background: transparent;
    border: 2px solid var(--color-primary-neon);
    color: var(--color-primary-neon);
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all 0.3s ease;
    text-shadow: 0 0 5px var(--color-primary-neon);
}

.btn:hover {
    background: var(--color-primary-neon);
    color: var(--color-bg);
    box-shadow: 0 0 20px var(--color-primary-neon);
    text-shadow: none;
}

.btn-secondary {
    border-color: var(--color-secondary-neon);
    color: var(--color-secondary-neon);
    text-shadow: 0 0 5px var(--color-secondary-neon);
}

.btn-secondary:hover {
    background: var(--color-secondary-neon);
    color: var(--color-bg);
    box-shadow: 0 0 20px var(--color-secondary-neon);
    text-shadow: none;
}

/* Custom Alert Modal (for "copied") */
#alert-modal {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 150%);
    background: #fff;
    color: var(--color-bg);
    padding: 1rem 2rem;
    border-radius: 8px;
    z-index: 200;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transition: transform 0.4s ease-in-out;
}

#alert-modal.show {
    transform: translate(-50%, 0);
}

/* --- 7. Responsive Design --- */
@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    .hero { min-height: 40vh; padding-top: 8rem; }
    
    nav { padding: 1rem 5%; }
    .nav-logo { font-size: 1.2rem; }
    .nav-links a { margin-left: 1rem; font-size: 0.9rem; }
    
    .suggestions-list {
        grid-template-columns: 1fr;
    }
    
    .generator-options {
        grid-template-columns: 1fr;
    }
    
    .glass-card { padding: 1.5rem; }
    
    #password-input { padding-right: 6rem; } /* Ensure space for icons */
}
