/* Profile Page Styles */
.profile-main {
    margin-top: 140px;
    min-height: calc(100vh - 140px);
    background: #f8f9fa;
    padding: 2rem 0;
}

/* Profile Header */
.profile-header {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    overflow: hidden;
}

.profile-header-content {
    padding: 2rem;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    text-align: center;
}

.profile-info h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.2rem;
    font-weight: 600;
}

.profile-email {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

.profile-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-member {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.badge-active {
    background: #f39c12;
    color: white;
}

/* Profile Content */
.profile-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Profile Navigation */
.profile-nav {
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.nav-tabs {
    display: flex;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: none;
    border: none;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #27ae60;
}

.tab-btn.active {
    background: white;
    color: #27ae60;
    border-bottom: 3px solid #27ae60;
}

.tab-btn i {
    font-size: 1.1rem;
}

/* Tab Contents */
.tab-contents {
    padding: 0;
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

.content-section {
    margin-bottom: 2rem;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

/* Form Styles */
.profile-form {
    margin-bottom: 0;
}

/* General Tab Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Security Tab Special Layout - 완전히 새로운 구조 */
#security .form-grid {
    display: block; /* 그리드 대신 블록 사용 */
    margin-bottom: 2rem;
}

#security .password-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

#security .password-requirements-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

#security .confirm-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.form-group input[readonly] {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-note {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-style: italic;
}

/* Password Input */
.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input input {
    flex: 1;
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #27ae60;
}

/* Password Requirements */
.password-requirements {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.password-requirements h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #2c3e50;
}

.requirements-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.requirements-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.requirements-list li.valid {
    color: #27ae60;
}

.requirements-list li i {
    width: 16px;
    font-size: 0.8rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    justify-content: flex-start;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: #27ae60;
    color: white;
}

.btn-primary:hover {
    background: #2ecc71;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Loading States */
.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-main {
        margin-top: 80px;
        padding: 1rem 0;
    }

    .profile-header-content {
        padding: 1.5rem;
    }

    .profile-info h1 {
        font-size: 1.8rem;
    }

    .nav-tabs {
        flex-direction: row;
        display: flex;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 1rem 0.5rem;
        text-align: center;
        border-bottom: 1px solid #e9ecef;
    }

    .tab-btn.active {
        background: white;
        color: #27ae60;
        border-bottom: 3px solid #27ae60;
        border-left: none;
    }

    .tab-content {
        padding: 1.5rem;
    }

    .form-grid,
    #security .password-row,
    #security .password-requirements-row,
    #security .confirm-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .profile-header-content {
        padding: 1rem;
    }

    .profile-info h1 {
        font-size: 1.5rem;
    }

    .profile-email {
        font-size: 1rem;
    }

    .nav-tabs {
        flex-direction: row;
    }

    .tab-btn {
        padding: 0.8rem 0.25rem;
        font-size: 0.85rem;
    }

    .tab-btn span {
        display: block;
    }

    .tab-content {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .form-grid,
    #security .password-row,
    #security .password-requirements-row,
    #security .confirm-row {
        gap: 0.75rem;
    }
}

@media (max-width: 360px) {
    .tab-btn span {
        display: none;
    }
    
    .tab-btn i {
        font-size: 1.2rem;
    }
    
    .tab-btn {
        padding: 1rem 0.5rem;
    }
}

/* Family Members Section */
.family-section {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 2rem;
    background: white;
}

.family-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.family-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.family-content {
    padding: 1.5rem;
}

.family-member {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.family-member:last-child {
    margin-bottom: 0;
}

.family-member:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.member-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.member-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #27ae60;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.member-details h4 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.member-details p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic; /* 이메일을 이탤릭으로 표시 */
}

.member-details small {
    color: #6c757d;
    font-size: 0.8rem;
}

.member-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit,
.btn-delete {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-edit {
    background: #f39c12;
    color: white;
}

.btn-edit:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.empty-family {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state {
    color: #6c757d;
}

.empty-state h4 {
    margin-bottom: 0.5rem;
    color: #6c757d;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* 모바일에서 탭이 한 줄에 표시되도록 수정 */
@media (max-width: 768px) {
    .nav-tabs {
        display: flex;
        justify-content: space-between;
        overflow-x: auto;
        white-space: nowrap;
        padding: 0;
    }

    .tab-btn {
        flex: 1;
        min-width: 0;
        padding: 1rem 0.5rem;
        font-size: 0.8rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        border-bottom: 3px solid transparent;
    }

    .tab-btn.active {
        border-bottom-color: #27ae60;
    }

    .tab-btn i {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .tab-btn span {
        font-size: 0.75rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* Family 섹션 모바일 최적화 */
    .family-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .family-content {
        padding: 1rem;
    }

    .member-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .member-details p {
        word-break: break-all;
        font-size: 0.8rem;
    }
    
    .member-info {
        align-items: flex-start;
    }

    .member-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 0.8rem 0.25rem;
        font-size: 0.7rem;
    }

    .tab-btn i {
        font-size: 0.9rem;
    }

    .tab-btn span {
        font-size: 0.7rem;
    }
}

/* 매우 작은 화면에서는 아이콘만 표시 */
@media (max-width: 360px) {
    .tab-btn span {
        display: none;
    }
    
    .tab-btn i {
        font-size: 1.2rem;
    }
    
    .tab-btn {
        padding: 1rem 0.5rem;
    }
    
    .member-details p {
        font-size: 0.75rem;
    }
}
