/**
 * Frontend CSS for CrushMatch Groups
 * Modern, responsive design with smooth animations
 */

/* Reset and base styles */
.cmg-container * {
    box-sizing: border-box;
}

.cmg-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Header */
.cmg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    position: relative;
}

.cmg-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #e91e63, #ff4081);
}

.cmg-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #e91e63, #ff4081);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cmg-like-balance {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cmg-like-balance:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.cmg-likes-count {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #e91e63;
    margin-bottom: 4px;
    animation: cmg-pulse 2s infinite;
}

.cmg-likes-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Messages */
.cmg-messages {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 500;
    animation: cmg-slideDown 0.3s ease;
}

.cmg-messages.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 1px solid #b8daff;
    color: #155724;
}

.cmg-messages.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Buy likes section */
.cmg-buy-likes-section {
    margin-bottom: 30px;
}

.cmg-buy-likes-card {
    background: linear-gradient(135deg, #ff4081 0%, #e91e63 100%);
    color: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.3);
    animation: cmg-slideIn 0.5s ease;
}

.cmg-buy-likes-card h3 {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
}

.cmg-buy-likes-card p {
    margin: 0 0 20px 0;
    opacity: 0.9;
    font-size: 16px;
}

/* Action cards */
.cmg-group-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.cmg-action-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cmg-action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e91e63, #ff4081);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.cmg-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.cmg-action-card:hover::before {
    transform: scaleX(1);
}

.cmg-action-card h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.cmg-action-card p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.cmg-join-group-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.cmg-join-group-form input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: border-color 0.3s ease;
}

.cmg-join-group-form input:focus {
    outline: none;
    border-color: #e91e63;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.cmg-join-group-form input.cmg-input-error {
    border-color: #dc3545;
    animation: cmg-shake 0.5s ease;
}

/* Groups section */
.cmg-my-groups h3 {
    margin: 0 0 25px 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.cmg-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.cmg-group-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cmg-group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.cmg-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cmg-group-code {
    font-size: 18px;
    font-weight: 800;
    color: #333;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 8px 16px;
    border-radius: 8px;
    letter-spacing: 1px;
    border: 2px solid #e9ecef;
}

.cmg-member-count {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Stats */
.cmg-group-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.cmg-stat {
    text-align: center;
    flex: 1;
}

.cmg-stat-number {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #e91e63;
    margin-bottom: 4px;
}

.cmg-stat-label {
    display: block;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Notifications */
.cmg-notification {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 500;
    animation: cmg-slideIn 0.5s ease;
}

.cmg-likes-notification {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #90caf9;
    color: #1565c0;
}

.cmg-match-notification {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.cmg-match-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    animation: cmg-bounce 0.6s ease;
}

.cmg-match-item:last-child {
    border-bottom: none;
}

/* Members list */
.cmg-group-members {
    margin-top: 15px;
}

.cmg-group-members h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cmg-members-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 5px;
}

.cmg-member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.cmg-member-item:hover {
    background-color: #f8f9fa;
}

.cmg-member-item:last-child {
    border-bottom: none;
}

.cmg-member-name {
    font-weight: 500;
    color: #333;
}

.cmg-liked-indicator {
    color: #4caf50;
    font-size: 12px;
    font-weight: 600;
    background: #e8f5e8;
    padding: 4px 8px;
    border-radius: 12px;
}

/* Buttons */
.cmg-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cmg-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cmg-btn:hover::before {
    width: 200px;
    height: 200px;
}

.cmg-btn-primary {
    background: linear-gradient(135deg, #e91e63, #ff4081);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.cmg-btn-primary:hover {
    background: linear-gradient(135deg, #c2185b, #e91e63);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

.cmg-btn-secondary {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.cmg-btn-secondary:hover {
    background: linear-gradient(135deg, #545b62, #495057);
    transform: translateY(-2px);
}

.cmg-btn-like {
    background: linear-gradient(135deg, #ff4081, #f06292);
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(255, 64, 129, 0.3);
}

.cmg-btn-like:hover {
    background: linear-gradient(135deg, #e91e63, #ff4081);
    transform: scale(1.05);
}

.cmg-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading states */
.cmg-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.cmg-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: cmg-spin 1s linear infinite;
}

/* Modals */
.cmg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.cmg-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: cmg-modalIn 0.3s ease;
}

.cmg-modal-header {
    background: linear-gradient(135deg, #e91e63, #ff4081);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    text-align: center;
}

.cmg-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.cmg-modal-content {
    padding: 30px;
    text-align: center;
}

.cmg-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.cmg-group-code-display {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 4px;
    color: #e91e63;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 2px dashed #e91e63;
}

.cmg-match-modal {
    text-align: center;
}

.cmg-match-celebration {
    font-size: 80px;
    margin: 20px 0;
    animation: cmg-pulse 1s infinite;
}

/* Empty states */
.cmg-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.cmg-empty-state::before {
    content: '💕';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Error states */
.cmg-error-text {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}

.cmg-no-likes-msg {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Group footer */
.cmg-group-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.cmg-joined-date {
    color: #999;
    font-size: 12px;
}

/* Animations */
@keyframes cmg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes cmg-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes cmg-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes cmg-slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes cmg-slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes cmg-modalIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes cmg-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cmg-pulse-animation {
    animation: cmg-pulse 0.8s ease-in-out infinite;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .cmg-container {
        padding: 15px;
    }
    
    .cmg-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .cmg-header h2 {
        font-size: 24px;
    }
    
    .cmg-group-actions {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cmg-groups-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cmg-group-card {
        padding: 15px;
    }
    
    .cmg-group-stats {
        gap: 15px;
    }
    
    .cmg-modal {
        width: 95%;
        margin: 20px;
    }
    
    .cmg-group-code-display {
        font-size: 28px;
        letter-spacing: 2px;
        padding: 15px;
    }
    
    .cmg-join-group-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .cmg-join-group-form input {
        font-size: 18px;
        padding: 15px;
    }
    
    .cmg-action-card,
    .cmg-buy-likes-card {
        padding: 20px;
    }
    
    .cmg-like-balance {
        padding: 12px 16px;
    }
    
    .cmg-likes-count {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .cmg-container {
        padding: 10px;
    }
    
    .cmg-header h2 {
        font-size: 20px;
    }
    
    .cmg-group-code {
        font-size: 16px;
        padding: 6px 12px;
    }
    
    .cmg-stat-number {
        font-size: 20px;
    }
    
    .cmg-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Touch-friendly mobile interactions */
@media (hover: none) and (pointer: coarse) {
    .cmg-touch-active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .cmg-btn:active {
        transform: scale(0.95);
    }
    
    .cmg-group-card:hover {
        transform: none;
    }
    
    .cmg-action-card:hover {
        transform: none;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .cmg-container {
        color: #e0e0e0;
    }
    
    .cmg-action-card,
    .cmg-group-card {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .cmg-modal {
        background: #2a2a2a;
        color: #e0e0e0;
    }
}