* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.profile-header h1 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
}

.profile-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}

.profile-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.profile-picture-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-picture {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-color);
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--text-secondary);
}

.profile-picture:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.change-photo-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.change-photo-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.change-photo-btn:active {
    transform: translateY(0);
}

.profile-form .form-group {
    margin-bottom: 1.5rem;
}

.profile-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.profile-form input,
.profile-form textarea,
.profile-form select {
    width: 100%;
    padding: 0.875rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    min-height: 44px;
}

.profile-form input:focus,
.profile-form textarea:focus,
.profile-form select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.profile-form textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.875rem 1.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 0.95rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.password-toggle {
    position: relative;
}

.password-toggle-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-icon:hover {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

/* Form validation styles */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.success-message {
    color: #10b981;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Loading state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Tablet Responsive (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .profile-card {
        padding: 1.5rem;
    }
}

/* Tablet Portrait (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .profile-picture-section {
        margin-bottom: 1rem;
    }
    
    .profile-picture {
        width: 150px;
        height: 150px;
    }
}

/* Mobile Landscape (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        padding: 1rem;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .profile-header h1 {
        font-size: 1.75rem;
    }
    
    .profile-card {
        padding: 1.5rem;
        border-radius: 0.5rem;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .profile-picture-section {
        margin-bottom: 1rem;
    }
    
    .profile-picture {
        width: 140px;
        height: 140px;
        font-size: 3rem;
    }
    
    .form-actions {
        justify-content: stretch;
    }
    
    .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Mobile Portrait (up to 575px) */
@media (max-width: 575px) {
    .container {
        padding: 0.75rem;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .profile-header h1 {
        font-size: 1.5rem;
    }
    
    .profile-card {
        padding: 1rem;
        border-radius: 0.5rem;
        margin: 0 -0.25rem;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .profile-picture-section {
        margin-bottom: 1rem;
    }
    
    .profile-picture {
        width: 120px;
        height: 120px;
        font-size: 2.5rem;
        border-width: 3px;
    }
    
    .change-photo-btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        max-width: 200px;
    }
    
    .profile-form .form-group {
        margin-bottom: 1.25rem;
    }
    
    .profile-form input,
    .profile-form textarea,
    .profile-form select {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .password-toggle-icon {
        right: 10px;
        min-width: 32px;
        min-height: 32px;
    }
}

/* Extra Small Mobile (up to 374px) */
@media (max-width: 374px) {
    .container {
        padding: 0.5rem;
    }
    
    .profile-header h1 {
        font-size: 1.25rem;
    }
    
    .profile-card {
        padding: 0.75rem;
        margin: 0;
    }
    
    .profile-picture {
        width: 100px;
        height: 100px;
        font-size: 2rem;
        border-width: 2px;
    }
    
    .change-photo-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .profile-form input,
    .profile-form textarea,
    .profile-form select {
        padding: 0.625rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .profile-form input,
    .profile-form textarea,
    .profile-form select {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        min-height: 48px;
    }
    
    .change-photo-btn {
        min-height: 48px;
    }
    
    .password-toggle-icon {
        min-width: 44px;
        min-height: 44px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .profile-card {
        border-width: 2px;
    }
    
    .profile-form input,
    .profile-form textarea,
    .profile-form select {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .profile-picture:hover {
        transform: none;
    }
    
    .btn:hover,
    .change-photo-btn:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .container {
        max-width: none;
        padding: 0;
    }
    
    .profile-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .change-photo-btn,
    .form-actions {
        display: none;
    }
    
    .profile-form input,
    .profile-form textarea {
        border: none;
        background: transparent;
        padding: 0.25rem 0;
        border-bottom: 1px solid #ccc;
    }
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .profile-form input::placeholder,
    .profile-form textarea::placeholder {
        color: var(--text-secondary);
        opacity: 0.7;
    }
}