/* Profile Page Styles */

.profile-main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Profile Header Section */
.profile-header-section {
    margin-bottom: 40px;
}

.profile-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.profile-avatar-section {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    font-size: 5rem;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.avatar-edit-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-edit-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

.profile-info {
    flex: 1;
}

.profile-name-level {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.profile-info h2 {
    margin: 0;
    font-size: 2rem;
}

.profile-level {
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-email {
    margin: 0;
    opacity: 0.95;
}

.profile-bio {
    margin: 5px 0;
    font-style: italic;
    opacity: 0.9;
}

.profile-joinDate {
    margin: 8px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.85;
}

.profile-edit-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.profile-edit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.profile-revoke-btn {
    padding: 10px 20px;
    background: rgba(255, 100, 100, 0.2);
    color: white;
    border: 2px solid rgba(255, 100, 100, 0.3);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    margin-left: 10px;
}

.profile-revoke-btn:hover {
    background: rgba(255, 100, 100, 0.4);
    border-color: rgba(255, 100, 100, 0.6);
}

/* Access Info */
.access-info {
    margin-top: 15px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #667eea;
    border-radius: 5px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.access-info p {
    margin: 0;
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-mini-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-mini-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-label {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    margin: 5px 0 0 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
}

/* Profile Section */
.profile-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.profile-section h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Streak Section */
.streak-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.streak-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.streak-message {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.streak-progress-bar {
    width: 100%;
    height: 30px;
    background: #ecf0f1;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid #bdc3c7;
}

.streak-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
    border-radius: 13px;
    width: 0%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.streak-details {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.streak-milestones {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.milestone {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #bdc3c7;
    font-weight: 600;
    color: #7f8c8d;
    transition: all 0.3s ease;
    cursor: pointer;
}

.milestone.unlocked {
    background: #d5f4e6;
    border-left-color: #27ae60;
    color: #27ae60;
}

.milestone span {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    margin-top: 3px;
}

/* XP Section */
.xp-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.xp-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.xp-bar {
    width: 100%;
    height: 25px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    width: 0%;
    transition: width 0.5s ease;
}

.xp-note {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* Calendar Section */
.calendar-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.calendar-nav {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.calendar-nav:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #7f8c8d;
    text-align: center;
    font-size: 0.85rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    background: white;
    border: 1px solid #ddd;
    color: #7f8c8d;
    transition: all 0.3s ease;
}

.calendar-day.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
    border: none;
}

.calendar-day:not(.empty):hover {
    background: #f0f3f4;
    border-color: #667eea;
}

.calendar-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.legend-active {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 3px;
}

.legend-inactive {
    width: 12px;
    height: 12px;
    background: #ddd;
    border-radius: 3px;
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.achievement-badge:hover {
    transform: scale(1.05);
    border-color: #667eea;
}

.achievement-badge.locked {
    opacity: 0.6;
    filter: grayscale(100%);
}

.achievement-icon {
    font-size: 2.5rem;
}

.achievement-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.activity-icon {
    font-size: 1.8rem;
    min-width: 40px;
    text-align: center;
}

.activity-content {
    flex: 1;
}

.activity-title {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

.activity-time {
    margin: 5px 0 0 0;
    font-size: 0.8rem;
    color: #7f8c8d;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #ecf0f1;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    margin: 5px 0 0 0;
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Avatar Picker */
.avatar-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.avatar-option {
    aspect-ratio: 1;
    font-size: 2.5rem;
    border: 2px solid #ddd;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-option:hover {
    border-color: #667eea;
    background: #f8f9fa;
    transform: scale(1.05);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #764ba2;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #ddd;
}

/* Dark Mode Support */
body.dark-mode .profile-card {
    background: linear-gradient(135deg, #2d3561 0%, #1a1a2e 100%);
}

body.dark-mode .stat-mini-card {
    background: #1e1e1e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .stat-value {
    color: #667eea;
}

body.dark-mode .profile-revoke-btn {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.25);
    color: #ff9999;
}

body.dark-mode .profile-revoke-btn:hover {
    background: rgba(255, 100, 100, 0.25);
    border-color: rgba(255, 100, 100, 0.5);
}

body.dark-mode .access-info {
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
    color: #e0e0e0;
}

body.dark-mode .profile-section {
    background: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .profile-section h2 {
    color: #ecf0f1;
}

body.dark-mode .streak-message,
body.dark-mode .xp-header {
    color: #ecf0f1;
}

body.dark-mode .milestone {
    background: #2d2d2d;
    color: #bdc3c7;
}

body.dark-mode .milestone.unlocked {
    background: #1a3a2a;
    color: #4db8a8;
}

body.dark-mode .xp-container {
    background: #2d2d2d;
}

body.dark-mode .calendar-container {
    background: #2d2d2d;
}

body.dark-mode .calendar-day {
    background: #3d3d3d;
    border-color: #4d4d4d;
    color: #bdc3c7;
}

body.dark-mode .calendar-day.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

body.dark-mode .calendar-day:not(.empty):hover {
    background: #4d4d4d;
    border-color: #667eea;
}

body.dark-mode .achievement-badge {
    background: #2d2d2d;
    border-color: #3d3d3d;
}

body.dark-mode .achievement-name {
    color: #ecf0f1;
}

body.dark-mode .activity-item {
    background: #2d2d2d;
    border-left-color: #667eea;
}

body.dark-mode .activity-title {
    color: #ecf0f1;
}

body.dark-mode .modal-content {
    background: #1e1e1e;
}

body.dark-mode .modal-header {
    border-bottom-color: #3d3d3d;
}

body.dark-mode .modal-header h2 {
    color: #ecf0f1;
}

body.dark-mode .modal-footer {
    border-top-color: #3d3d3d;
}

body.dark-mode .form-group label {
    color: #ecf0f1;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background: #2d2d2d;
    color: #ecf0f1;
    border-color: #3d3d3d;
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group textarea:focus {
    border-color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-card {
        flex-direction: column;
        text-align: center;
        gap: 20px !important;
        padding: 20px;
    }

    .profile-avatar {
        font-size: 3.5rem;
        width: 100px;
        height: 100px;
    }

    .profile-name-level {
        flex-direction: column;
        gap: 10px;
    }

    .profile-info {
        width: 100%;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
        width: 100%;
        margin-left: 0 !important;
        margin-bottom: 8px;
    }

    .access-info {
        margin-top: 15px;
        padding: 10px 12px;
    }

    .streak-container {
        grid-template-columns: 1fr;
    }

    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-mini-card {
        padding: 15px 10px;
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }

    .avatar-picker {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .avatar-option {
        padding: 8px;
        font-size: 2rem;
    }

    .calendar-container {
        padding: 15px 10px;
    }

    .calendar-header h3 {
        font-size: 1.1rem;
    }

    .calendar-weekdays,
    .calendar-days {
        font-size: 0.85rem;
    }

    .calendar-day {
        padding: 6px 2px;
        font-size: 0.8rem;
    }

    .calendar-legend {
        font-size: 0.8rem;
        gap: 10px;
    }

    .achievement-badge {
        padding: 10px 5px;
    }

    .achievement-icon {
        font-size: 2rem;
    }

    .achievement-name {
        font-size: 0.7rem;
    }

    .activity-item {
        padding: 10px 12px;
    }

    .activity-icon {
        font-size: 1.5rem;
    }

    .activity-time {
        font-size: 0.75rem;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .profile-main {
        padding: 10px;
    }

    .profile-card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .profile-avatar {
        font-size: 2.5rem;
        width: 80px;
        height: 80px;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        width: 100%;
    }

    .profile-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .profile-section h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-mini-card {
        padding: 12px 10px;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        gap: 8px;
    }

    .achievement-badge {
        padding: 8px 4px;
    }

    .achievement-icon {
        font-size: 1.8rem;
    }

    .achievement-name {
        font-size: 0.65rem;
    }

    .calendar-container {
        padding: 12px 8px;
    }

    .calendar-header {
        padding: 8px 0;
    }

    .calendar-header button {
        padding: 4px 8px;
        font-size: 1rem;
    }

    .calendar-header h3 {
        font-size: 1rem;
        margin: 0 5px;
    }

    .calendar-weekdays {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
        font-size: 0.7rem;
        font-weight: 600;
        margin-bottom: 5px;
    }

    .calendar-weekdays div {
        text-align: center;
    }

    .calendar-days {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
    }

    .calendar-day {
        padding: 4px 2px;
        font-size: 0.75rem;
        min-height: 25px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calendar-legend {
        font-size: 0.7rem;
        gap: 8px;
        margin-top: 10px;
    }

    .legend-active,
    .legend-inactive {
        width: 12px;
        height: 12px;
    }

    .activity-item {
        padding: 8px 10px;
        flex-direction: column;
        gap: 5px;
    }

    .activity-icon {
        font-size: 1.3rem;
    }

    .activity-title {
        font-size: 0.85rem;
    }

    .activity-time {
        font-size: 0.7rem;
    }

    .streak-container {
        gap: 15px;
    }

    .streak-info h3 {
        font-size: 1rem;
    }

    .streak-info p {
        font-size: 0.9rem;
    }

    .streak-message {
        font-size: 0.85rem;
    }

    .milestone {
        width: 25px;
        height: 25px;
        font-size: 0.6rem;
    }

    .xp-container {
        padding: 12px 10px;
    }

    .xp-header {
        font-size: 0.9rem;
    }

    .xp-text {
        font-size: 0.75rem;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .form-hint {
        font-size: 0.7rem;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        gap: 8px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 10px 15px;
        font-size: 0.85rem;
        flex: 1;
    }

    .access-info {
        padding: 10px;
        font-size: 0.8rem;
        margin-top: 12px;
    }
}

/* ENHANCED MOBILE OPTIMIZATION */

/* Tablet Devices (768px and below) */
@media (max-width: 768px) {
    .profile-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .profile-info h2 {
        font-size: 1.6rem;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        width: 100%;
        padding: 12px;
        margin-top: 8px;
    }

    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* STREAK SECTION MOBILE OPTIMIZATION */
    .streak-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .streak-milestones {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .milestone {
        padding: 12px;
        text-align: center;
        border-left: none;
        border-top: 4px solid #bdc3c7;
        border-radius: 8px;
    }

    .milestone.unlocked {
        border-top-color: #27ae60;
        border-left: none;
    }

    .milestone span {
        font-size: 0.75rem;
    }
}

/* Mid-Size Phones (600px and below) */
@media (max-width: 600px) {
    .profile-main {
        padding: 12px;
    }

    .profile-card {
        padding: 18px;
    }

    .profile-avatar {
        font-size: 4rem;
        width: 100px;
        height: 100px;
    }

    .profile-info h2 {
        font-size: 1.4rem;
    }

    .stat-mini-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 1.4rem;
        font-weight: 700;
    }

    .profile-section {
        padding: 16px;
    }

    /* STREAK SECTION - 600px OPTIMIZATION */
    .streak-container {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .streak-info {
        gap: 12px;
    }

    .streak-message {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .streak-progress-bar {
        height: 35px;
        border-radius: 18px;
    }

    .streak-progress-fill {
        border-radius: 16px;
        font-size: 0.9rem;
        padding-right: 8px;
    }

    .streak-details {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .streak-milestones {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .milestone {
        padding: 14px 10px;
        font-size: 0.95rem;
        border-top: 4px solid #bdc3c7;
        border-left: none;
        transition: all 0.3s ease;
    }

    .milestone span {
        font-size: 0.8rem;
        margin-top: 4px;
    }

    .milestone.unlocked {
        border-top-color: #27ae60;
        background: #d5f4e6;
    }

    .achievement-badge {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .achievement-icon {
        font-size: 2rem;
        flex-shrink: 0;
    }

    .achievement-content {
        flex: 1;
        text-align: left;
    }

    .study-calendar {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px;
    }

    .modal-body {
        max-height: calc(85vh - 140px);
    }

    .form-group input,
    .form-group textarea {
        font-size: 1rem;
        padding: 10px;
    }
}

/* Small Phones (480px and below) */
@media (max-width: 480px) {
    header .header-content h1 {
        font-size: 1.5rem;
        margin: 12px 0 8px 0;
    }

    .profile-card {
        padding: 16px;
        margin-bottom: 14px;
    }

    .profile-avatar {
        font-size: 3.5rem;
        width: 90px;
        height: 90px;
    }

    .profile-avatar-section {
        margin: 0 auto;
    }

    .profile-info h2 {
        font-size: 1.3rem;
        margin: 0;
    }

    .profile-name-level {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        font-size: 0.85rem;
        padding: 9px;
        margin-top: 5px;
        width: 100%;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-mini-card {
        padding: 10px;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .access-info {
        padding: 10px;
        font-size: 0.8rem;
        margin-top: 8px;
        border-radius: 9px;
    }

    #renewMonths {
        padding: 5px;
        font-size: 0.8rem;
        min-width: 70px;
    }

    #renewBtn {
        padding: 8px;
        font-size: 0.8rem;
        width: 100%;
        margin-top: 6px;
    }

    .profile-section {
        padding: 14px;
        margin-bottom: 14px;
    }

    .profile-section h2 {
        font-size: 1.1rem;
        margin: 0 0 10px 0;
    }

    .profile-section p,
    .profile-section li {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    /* STREAK SECTION - 480px OPTIMIZATION */
    .streak-container {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .streak-info {
        gap: 10px;
    }

    .streak-message {
        font-size: 0.95rem;
        line-height: 1.3;
        font-weight: 600;
        color: #2c3e50;
    }

    .streak-progress-bar {
        height: 32px;
        border-radius: 16px;
        border: 2px solid #bdc3c7;
    }

    .streak-progress-fill {
        border-radius: 14px;
        font-size: 0.8rem;
        padding-right: 6px;
        font-weight: 600;
    }

    .streak-details {
        font-size: 0.8rem;
        color: #7f8c8d;
        line-height: 1.3;
    }

    .streak-milestones {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .milestone {
        padding: 12px 8px;
        font-size: 0.85rem;
        font-weight: 600;
        background: #f8f9fa;
        border-radius: 8px;
        border-top: 4px solid #bdc3c7;
        border-left: none;
        color: #7f8c8d;
        text-align: center;
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .milestone:hover {
        background: #ecf0f1;
    }

    .milestone span {
        display: block;
        font-size: 0.7rem;
        font-weight: 400;
        margin-top: 3px;
        line-height: 1.2;
    }

    .milestone.unlocked {
        background: linear-gradient(135deg, #d5f4e6 0%, #c8f0dc 100%);
        border-top-color: #27ae60;
        color: #27ae60;
        font-weight: 700;
        box-shadow: 0 2px 8px rgba(39, 174, 96, 0.15);
    }

    .achievements-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .achievement-badge {
        padding: 10px;
        gap: 10px;
    }

    .achievement-icon {
        font-size: 1.8rem;
    }

    .achievement-title {
        font-size: 0.9rem;
    }

    .achievement-description {
        font-size: 0.75rem;
    }

    .study-calendar {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .calendar-day {
        font-size: 0.65rem;
        padding: 5px;
    }

    .xp-container {
        padding: 12px;
    }

    .xp-header {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .xp-text {
        font-size: 0.75rem;
    }

    .modal-content {
        width: 96%;
        max-height: 80vh;
        margin: 15px auto;
    }

    .modal-header {
        padding: 14px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 14px;
        max-height: calc(80vh - 130px);
    }

    .modal-footer {
        padding: 14px;
        gap: 8px;
    }

    .btn-primary,
    .btn-secondary {
        flex: 1;
        min-width: 100px;
        padding: 9px 10px;
        font-size: 0.8rem;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 9px;
        border-radius: 6px;
    }

    .form-hint {
        font-size: 0.75rem;
        margin-top: 3px;
    }

    #profileImagePreview {
        width: 70px;
        height: 70px;
        font-size: 2.5rem;
    }

    .recent-activity-item {
        padding: 8px;
        font-size: 0.85rem;
    }

    .recent-activity-item strong {
        margin-bottom: 3px;
    }
}

/* Extra Small Phones (under 380px) */
@media (max-width: 380px) {
    .profile-main {
        padding: 8px;
    }

    header .header-content h1 {
        font-size: 1.3rem;
    }

    .profile-card {
        padding: 12px;
        gap: 10px;
    }

    .profile-avatar {
        font-size: 3rem;
        width: 80px;
        height: 80px;
    }

    .profile-info h2 {
        font-size: 1.2rem;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        font-size: 0.8rem;
        padding: 8px;
    }

    .stats-overview {
        gap: 8px;
    }

    .stat-mini-card {
        padding: 8px;
        font-size: 0.85rem;
    }

    /* STREAK SECTION - 380px OPTIMIZATION */
    .profile-section h2 {
        font-size: 1rem;
        margin: 0 0 8px 0;
    }

    .streak-message {
        font-size: 0.9rem;
    }

    .streak-progress-bar {
        height: 28px;
        border-radius: 14px;
    }

    .streak-milestones {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .milestone {
        padding: 10px 6px;
        font-size: 0.8rem;
        border-top-width: 3px;
    }

    .milestone span {
        font-size: 0.65rem;
    }

    .study-calendar {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .calendar-day {
        font-size: 0.6rem;
        padding: 3px;
    }
}

/* Mid-Size Phones (600px and below) */
@media (max-width: 600px) {
    .profile-main {
        padding: 12px;
    }

    .profile-card {
        padding: 18px;
    }

    .profile-avatar {
        font-size: 4rem;
        width: 100px;
        height: 100px;
    }

    .profile-info h2 {
        font-size: 1.4rem;
    }

    .stat-mini-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 1.4rem;
        font-weight: 700;
    }

    .profile-section {
        padding: 16px;
    }

    .achievements-grid {
        grid-template-columns: 1fr;
    }

    .achievement-badge {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .achievement-icon {
        font-size: 2rem;
        flex-shrink: 0;
    }

    .achievement-content {
        flex: 1;
        text-align: left;
    }

    .study-calendar {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px;
    }

    .modal-body {
        max-height: calc(85vh - 140px);
    }

    .form-group input,
    .form-group textarea {
        font-size: 1rem;
        padding: 10px;
    }
}

/* Small Phones (480px and below) */
@media (max-width: 480px) {
    header .header-content h1 {
        font-size: 1.5rem;
        margin: 12px 0 8px 0;
    }

    .profile-card {
        padding: 16px;
        margin-bottom: 14px;
    }

    .profile-avatar {
        font-size: 3.5rem;
        width: 90px;
        height: 90px;
    }

    .profile-avatar-section {
        margin: 0 auto;
    }

    .profile-info h2 {
        font-size: 1.3rem;
        margin: 0;
    }

    .profile-name-level {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        font-size: 0.85rem;
        padding: 9px;
        margin-top: 5px;
        width: 100%;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-mini-card {
        padding: 10px;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .access-info {
        padding: 10px;
        font-size: 0.8rem;
        margin-top: 8px;
        border-radius: 9px;
    }

    #renewMonths {
        padding: 5px;
        font-size: 0.8rem;
        min-width: 70px;
    }

    #renewBtn {
        padding: 8px;
        font-size: 0.8rem;
        width: 100%;
        margin-top: 6px;
    }

    .profile-section {
        padding: 14px;
        margin-bottom: 14px;
    }

    .profile-section h2 {
        font-size: 1.1rem;
        margin: 0 0 10px 0;
    }

    .profile-section p,
    .profile-section li {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .achievements-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .achievement-badge {
        padding: 10px;
        gap: 10px;
    }

    .achievement-icon {
        font-size: 1.8rem;
    }

    .achievement-title {
        font-size: 0.9rem;
    }

    .achievement-description {
        font-size: 0.75rem;
    }

    .study-calendar {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .calendar-day {
        font-size: 0.65rem;
        padding: 5px;
    }

    .streak-info h3 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .streak-info p {
        font-size: 0.8rem;
        margin: 3px 0;
    }

    .xp-container {
        padding: 12px;
    }

    .xp-header {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .xp-text {
        font-size: 0.75rem;
    }

    .milestone {
        width: 26px;
        height: 26px;
        font-size: 0.6rem;
    }

    .modal-content {
        width: 96%;
        max-height: 80vh;
        margin: 15px auto;
    }

    .modal-header {
        padding: 14px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 14px;
        max-height: calc(80vh - 130px);
    }

    .modal-footer {
        padding: 14px;
        gap: 8px;
    }

    .btn-primary,
    .btn-secondary {
        flex: 1;
        min-width: 100px;
        padding: 9px 10px;
        font-size: 0.8rem;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 9px;
        border-radius: 6px;
    }

    .form-hint {
        font-size: 0.75rem;
        margin-top: 3px;
    }

    #profileImagePreview {
        width: 70px;
        height: 70px;
        font-size: 2.5rem;
    }

    .recent-activity-item {
        padding: 8px;
        font-size: 0.85rem;
    }

    .recent-activity-item strong {
        margin-bottom: 3px;
    }
}

/* Extra Small Phones (under 380px) */
@media (max-width: 380px) {
    .profile-main {
        padding: 8px;
    }

    header .header-content h1 {
        font-size: 1.3rem;
    }

    .profile-card {
        padding: 12px;
        gap: 10px;
    }

    .profile-avatar {
        font-size: 3rem;
        width: 80px;
        height: 80px;
    }

    .profile-info h2 {
        font-size: 1.2rem;
    }

    .profile-edit-btn,
    .profile-revoke-btn {
        font-size: 0.8rem;
        padding: 8px;
    }

    .stats-overview {
        gap: 8px;
    }

    .stat-mini-card {
        padding: 8px;
        font-size: 0.85rem;
    }

    .study-calendar {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .calendar-day {
        font-size: 0.6rem;
        padding: 3px;
    }
}
