@import url("https://fonts.googleapis.com/css?family=Roboto:700&display=swap");

:root {
    --primary-color: #000;
    --secondary-color: #333;
    --background-color: #fff;
    --text-color: #000;
    --border-color: #ddd;
    --error-color: #ff4d4d;
    --warning-color: #ffcc00;
    --success-color: #00cc00;
    --very-strong-color: #00aa00;
    --intro-bg: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    --button-hover: #ffcc00;
    --action-button-bg: #f5f5f5;

    /* Typography */
    --base-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    --mono-font: monospace;
    --header-font: "Roboto", sans-serif;

    /* Shadows */
    --base-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --fast-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --standard-transition: all 0.3s ease;
}

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

body {
    font-family: var(--base-font);
    line-height: 1.6;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #e5e5f7;
    opacity: 0.8;
    background:
        radial-gradient(
            circle,
            transparent 20%,
            #e5e5f7 20%,
            #e5e5f7 80%,
            transparent 80%,
            transparent
        ),
        radial-gradient(
                circle,
                transparent 20%,
                #e5e5f7 20%,
                #e5e5f7 80%,
                transparent 80%,
                transparent
            )
            12.5px 12.5px,
        linear-gradient(#fcfdd9 1px, transparent 1px) 0 -0.5px,
        linear-gradient(90deg, #fcfdd9 1px, #e5e5f7 1px) -0.5px 0;
    background-size:
        25px 25px,
        25px 25px,
        12.5px 12.5px,
        12.5px 12.5px;
}

/* Layout */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

/* Components */
.status-emoji {
    font-size: 2rem;
    animation: pulseAnimation 2s infinite ease-in-out;
}

.intro-text {
    text-align: center;
    margin-bottom: 2rem;
    color: #fff;
    background: url("../images/security-illustration.png") no-repeat center;
    background-size: cover;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--base-shadow);
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-text::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.5) 100%
    );
    z-index: 1;
}

.intro-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
}

.intro-text p {
    margin: 0 0 2rem;
    font-size: 1.2rem;
    line-height: 1.6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Password Display Animation */
#password-header-text {
    color: #ffffff;
    margin: 0;
    font-family: var(--header-font);
    text-transform: uppercase;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#flip {
    height: 50px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
    width: fit-content;
    display: inline-block;
}

#flip > div {
    height: 45px;
    text-align: center;
    margin-bottom: 45px;
}

#flip > div > div {
    color: #fff;
    padding: 4px 12px;
    height: 45px;
    margin-bottom: 45px;
    display: inline-block;
    position: relative;
    text-align: center;
    min-width: 200px;
    background: rgba(66, 197, 138, 0.9);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#flip div:first-child {
    animation: show 5s linear infinite;
}

#flip div div {
    background: #42c58a;
}

#flip div:first-child div {
    background: rgba(78, 199, 243, 0.9);
}

#flip div:last-child div {
    background: rgba(220, 20, 60, 0.9);
}

/* Slider */
.slider-container {
    margin-bottom: 2rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.interactive-slider {
    position: relative;
    width: 100%;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    cursor: pointer;
    margin-top: 1rem;
    transition: height 0.3s ease;
    touch-action: none;
}

.interactive-slider:hover {
    height: 8px;
}

.slider-fill {
    position: absolute;
    height: 100%;
    border-radius: 3px;
    transition: var(--fast-transition);
    will-change: width, background-color;
}

.slider-fill.error {
    background-color: var(--error-color);
}
.slider-fill.warning {
    background-color: var(--warning-color);
}
.slider-fill.success {
    background-color: var(--success-color);
}

.slider-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: var(--fast-transition);
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider-value {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 1;
    transition: var(--fast-transition);
    pointer-events: none;
}

.interactive-slider:hover .slider-value,
.interactive-slider:active .slider-value {
    transform: translateX(-50%) translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Character Options */
.character-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Toggle Containers */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    position: relative;
}

.toggle-label,
.exclusion-toggle-label {
    flex: 1;
    text-align: left;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-container.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.toggle-error {
    position: absolute;
    bottom: -20px;
    left: 0;
    color: var(--error-color);
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toggle-error.show {
    opacity: 1;
}

/* Exclusion Options */
.exclusion-options {
    background-color: white;
    padding: 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.exclusion-options h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.exclusion-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Password Output */
.password-output-container {
    background-color: white;
    padding: 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.password-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.password-output {
    font-size: 2rem;
    font-family: var(--mono-font);
    word-break: break-all;
    flex: 1;
}

.password-actions {
    display: flex;
    gap: 1rem;
}

.action-button {
    background: transparent;
    color: var(--text-color);
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--standard-transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-button:hover {
    transform: scale(1.1);
    background-color: var(--action-button-bg);
}

.action-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Strength Meter */
.strength-container {
    background-color: white;
    padding: 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.strength-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.strength-header h3 {
    margin: 0;
}

.strength-value {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.strength-value.weak {
    color: var(--error-color);
}
.strength-value.medium {
    color: var(--warning-color);
}
.strength-value.strong {
    color: var(--success-color);
}
.strength-value.very-strong {
    color: var(--very-strong-color);
}

.strength-meter {
    width: 100%;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition:
        width 0.5s ease,
        background-color 0.5s ease;
}

.strength-fill.weak {
    background-color: var(--error-color);
}
.strength-fill.medium {
    background-color: var(--warning-color);
}
.strength-fill.strong {
    background-color: var(--success-color);
}
.strength-fill.very-strong {
    background-color: var(--very-strong-color);
}

.strength-suggestion {
    margin-top: 0.5rem;
    font-style: italic;
    color: #666;
}

/* Criteria List */
.criteria-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.criteria-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    background-color: #f5f5f5;
}

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

.criteria-icon.met {
    color: var(--success-color);
}
.criteria-icon.unmet {
    color: var(--error-color);
}

/* Password Characters */
.password-char {
    display: inline-block;
    transition: color 0.3s ease;
}

.password-char.uppercase {
    color: #4a90e2;
}
.password-char.lowercase {
    color: #50e3c2;
}
.password-char.number {
    color: #f5a623;
}
.password-char.special {
    color: #d0021b;
}
.password-char.hidden {
    color: var(--text-color) !important;
}

/* Footer */
footer {
    background: url("../images/security-footer.png") no-repeat center center;
    background-size: cover;
    color: #4c00f1;
    text-shadow: 0 0 1px rgb(66, 250, 207), 0 0 1px rgb(66, 250, 207), 0 0 1px rgb(66, 250, 207), 0 0 1px rgb(66, 250, 207); 
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

footer a {
    color: #4c00f1;
    text-shadow: 0 0 1px rgb(66, 250, 207), 0 0 1px rgb(66, 250, 207), 0 0 1px rgb(66, 250, 207), 0 0 1px rgb(66, 250, 207); 
    font-weight: bold;
    text-underline-offset: -0.5rem;
    transition: opacity 0.3s ease;
}

footer a:hover {
    opacity: 0.8;
}

/* Toggle Visibility */
#toggle-visibility-btn {
    position: relative;
}

#toggle-visibility-btn:hover::after {
    content: attr(aria-label);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

#toggle-visibility-btn:active svg {
    animation: eyePulse 0.3s ease-in-out;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animations */
.password-animation {
    animation: pulse 1s ease;
}

@keyframes pulseAnimation {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }
    30%,
    50%,
    70% {
        transform: translate3d(-2px, 0, 0);
    }
    40%,
    60% {
        transform: translate3d(2px, 0, 0);
    }
}

@keyframes show {
    0% {
        margin-top: -270px;
    }
    5% {
        margin-top: -180px;
    }
    33% {
        margin-top: -180px;
    }
    38% {
        margin-top: -90px;
    }
    66% {
        margin-top: -90px;
    }
    71% {
        margin-top: 0px;
    }
    99.99% {
        margin-top: 0px;
    }
    100% {
        margin-top: -270px;
    }
}

@keyframes eyePulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Media Queries */
@media (max-width: 768px) {
    body {
        /* Simplified background for mobile */
        background:
            radial-gradient(
                circle,
                transparent 20%,
                #e5e5f7 20%,
                #e5e5f7 80%,
                transparent 80%,
                transparent
            ),
            radial-gradient(
                    circle,
                    transparent 20%,
                    #e5e5f7 20%,
                    #e5e5f7 80%,
                    transparent 80%,
                    transparent
                )
                25px 25px;
        background-size:
            50px 50px,
            50px 50px;
    }

    .container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .intro-text {
        min-height: 300px;
        padding: 1.5rem 1rem;
    }

    .intro-text p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    #password-header-text {
        font-size: 16px;
    }

    #flip > div > div {
        min-width: 150px;
        height: 35px;
        padding: 2px 8px;
    }

    .slider-handle {
        width: 28px;
        height: 28px;
        margin-left: -14px;
        border-width: 3px;
    }

    .interactive-slider {
        height: 10px;
        margin-top: 0.5rem;
    }

    /* Make tappable area larger for mobile */
    .interactive-slider::before {
        content: "";
        position: absolute;
        top: -15px;
        left: 0;
        right: 0;
        bottom: -15px;
        z-index: 1;
    }

    .character-options {
        flex-direction: column;
        gap: 1rem;
    }

    .option-column {
        width: 100%;
    }

    .password-output-container {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .password-output {
        font-size: 1.2rem;
        padding: 0.5rem;
        min-height: 60px;
    }

    .password-actions {
        gap: 0.5rem;
    }

    .action-button {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .action-button svg {
        width: 20px;
        height: 20px;
    }

    .strength-container {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .strength-header {
        margin-bottom: 1rem;
    }
    .strength-header h3 {
        font-size: 1.1rem;
    }
    .strength-value {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }

    .criteria-list {
        gap: 0.5rem;
    }
    .criteria-item {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    .toggle-container {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .toggle-label {
        font-size: 0.9rem;
    }
    .toggle-switch {
        width: 44px;
        height: 24px;
    }

    .toggle-slider:before {
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
    }

    input:checked + .toggle-slider:before {
        transform: translateX(20px);
    }

    .exclusion-options {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .exclusion-options h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .exclusion-toggle-container {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .exclusion-toggle-label {
        font-size: 0.9rem;
    }
    footer {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .status-emoji {
        font-size: 1.5rem;
    }
    .intro-text {
        min-height: 250px;
    }

    .password-output {
        font-size: 1rem;
        min-height: 50px;
    }

    .action-button {
        width: 36px;
        height: 36px;
        padding: 6px;
    }

    .action-button svg {
        width: 18px;
        height: 18px;
    }
}

@media (hover: none) {
    .action-button:hover {
        transform: none;
    }
    .toggle-container:hover {
        background-color: transparent;
    }
    .option-button:hover {
        transform: none;
    }
}

@media (pointer: coarse) {
    .slider-handle {
        transform: translate(-50%, -50%) scale(1.2);
    }

    .interactive-slider {
        height: 12px;
    }

    .interactive-slider:active .slider-handle {
        transform: translate(-50%, -50%) scale(1.3);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    }
}
