* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #b30000;
    --primary-dark: #8a0000;
    --primary-light: rgba(179, 0, 0, 0.1);
    --secondary: #f8f8f8;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --white: #ffffff;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --weak: #ff4d4d;
    --medium: #ffa64d;
    --strong: #33cc33;
}

body {
    background-color: #f5f5f5;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Top Header Bar */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: var(--white);
    text-align: center;
    padding: 15px 0;
    box-shadow: var(--shadow);
    z-index: 100;
}

.top-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.top-header span {
    font-size: 0.85rem;
    font-weight: 300;
    opacity: 0.9;
    display: block;
}

.container {
    width: 100%;
    max-width: 450px;
    margin-top: 100px;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.form-box {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.form-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

label {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: -10px;
}

input {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
    width: 100%;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(179, 0, 0, 0.15);
    outline: none;
    background-color: var(--white);
}

.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    color: var(--text-light);
}

.forgot-password {
    text-align: right;
    margin-top: -10px;
}

.forgot-password a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.forgot-password a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

button {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: var(--white);
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(179, 0, 0, 0.25);
    margin-top: 0.5rem;
    width: 100%;
}

button:hover {
    background: linear-gradient(to right, var(--primary-dark), #700000);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(179, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

.signup-text {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.signup-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.signup-text a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

.footer a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Error message styling */
.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #c62828;
    display: none;
}

/* Permission error styling */
.permission-error {
    background-color: #fff3e0;
    color: #ef6c00;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #ef6c00;
    display: none;
}

.permission-error h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #e65100;
}

.permission-error ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

.permission-error li {
    margin-bottom: 5px;
}

.permission-error code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 500px) {
    .container {
        padding: 0 1rem;
        margin-top: 120px;
    }

    .form-box {
        padding: 2rem 1.5rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .top-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 380px) {
    .form-box {
        padding: 1.8rem 1.2rem;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    input {
        padding: 0.8rem;
    }

    button {
        padding: 0.9rem;
        font-size: 1rem;
    }
}

/* Extra small devices (phones, 320px and down) */
@media (max-width: 320px) {
    body {
        padding: 10px;
    }

    .top-header {
        padding: 12px 0;
    }

    .top-header h1 {
        font-size: 1.4rem;
    }

    .top-header span {
        font-size: 0.75rem;
    }

    .container {
        margin-top: 110px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 1rem;
    }

    .form-box {
        padding: 1.5rem 1rem;
    }

    input {
        padding: 0.7rem;
        font-size: 0.9rem;
    }

    button {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .signup-text {
        font-size: 0.9rem;
    }
}