body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 300;
}

h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 25px;
    font-size: 1.5em;
    font-weight: 400;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

button:active {
    transform: translateY(0);
}

#logout-button {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    margin-bottom: 20px;
    width: 120px;
    align-self: flex-end;
}

#logout-button:hover {
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

#contacts-list {
    list-style: none;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

#contacts-list li {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 20px;
    margin-bottom: 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

#contacts-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.contact-info {
    flex: 1;
}

.contact-info strong {
    color: #2d3748;
    font-size: 1.1em;
    margin-bottom: 5px;
    display: block;
}

.contact-info span {
    color: #4a5568;
    font-size: 0.9em;
    display: block;
    margin-bottom: 3px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.actions button {
    padding: 8px 12px;
    font-size: 14px;
    min-width: 60px;
    text-transform: none;
    letter-spacing: normal;
}

.actions button.delete {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.actions button.delete:hover {
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

#auth-message,
#contacts-message {
    text-align: center;
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    min-height: 20px;
    transition: all 0.3s ease;
}

#auth-message.error,
#contacts-message.error {
    background-color: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
}

#auth-message.success,
#contacts-message.success {
    background-color: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

/* Auth Toggle Buttons */
.auth-toggle {
    display: flex;
    margin-bottom: 25px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: normal;
}

.toggle-btn:hover {
    background: #cbd5e0;
    transform: none;
    box-shadow: none;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.toggle-btn:first-child {
    border-right: 1px solid #cbd5e0;
}

/* Auth Windows */
.auth-window {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.auth-window.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-window h2 {
    margin-bottom: 25px;
    color: #2d3748;
    font-weight: 400;
}

/* Auth Forms Styling */
.auth-window form {
    background: #f8fafc;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

#login-window form {
    border-left: 4px solid #38a169;
    background: linear-gradient(135deg, #f0fff4 0%, #f7fafc 100%);
}

#register-window form {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, #ebf4ff 0%, #f7fafc 100%);
}

/* Switch Text */
.switch-text {
    text-align: center;
    color: #718096;
    font-size: 14px;
    margin: 15px 0;
}

.switch-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.switch-text a:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Contact Form Styling */
#add-contact-form {
    background: #f0fff4;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #c6f6d5;
    border-left: 4px solid #38a169;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.3em;
    }

    #contacts-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .actions {
        width: 100%;
        justify-content: flex-end;
    }

    .contact-info {
        width: 100%;
    }

    #logout-button {
        align-self: stretch;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .actions {
        flex-direction: column;
        gap: 5px;
    }

    .actions button {
        width: 100%;
    }
}

/* Empty State */
#contacts-list li:only-child {
    text-align: center;
    color: #718096;
    font-style: italic;
    background: #f7fafc;
    border-left: 4px solid #cbd5e0;
}

/* Form Validation Styles */
input.error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

/* Success Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}
