/* StudyMate AI - SSO Authentication Center */
:root {
    --primary-color: #667EEA;
    --primary-light: #E6EDFF;
    --primary-dark: #4C51BF;
    --secondary-color: #764BA2;
    --success-color: #48BB78;
    --error-color: #F56565;
    --warning-color: #F6AD55;
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --background-primary: #FFFFFF;
    --background-secondary: #F7FAFC;
    --border: #E2E8F0;
    --border-light: #EDF2F7;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    animation: gradientShift 20s ease infinite;
    opacity: 0.5;
}

@keyframes gradientShift {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.container {
    width: 100%;
    max-width: 800px;
    position: relative;
    z-index: 2;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 24px 24px 0 0;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    animation: logoFloat 3s ease-in-out infinite;
    object-fit: contain;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.auth-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

.auth-form {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-form h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--background-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.form-group.checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 12px;
    transform: scale(1.2);
    accent-color: var(--primary-color);
}

.form-group.checkbox label {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    width: 100%;
    transform: translateY(0);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--background-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.form-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.form-footer p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.form-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.message-container {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    display: none;
}

.message-container.success {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(72, 187, 120, 0.2);
}

.message-container.error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(245, 101, 101, 0.2);
}

.dashboard-info {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 16px;
    line-height: 1.5;
}

.connected-services h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.service-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.service-button {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--background-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.service-button:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.service-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.service-details {
    flex: 1;
}

.service-name {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.service-desc {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
}

.dashboard-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.service-links {
    margin-top: 40px;
    text-align: center;
}

.service-links h3 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.service-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.service-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.service-link .service-icon {
    font-size: 28px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    width: 56px;
    height: 56px;
}

.service-link span {
    font-size: 14px;
    font-weight: 500;
}

/* 새로운 서비스 카드 그리드 스타일 */
.service-grid-new {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 160px;
    position: relative;
    overflow: hidden;
}

/* 서비스 카드 호버 효과 */
.service-card-1:hover {
    background: linear-gradient(135deg, #a8d5ba 0%, #8cc8a0 100%) !important;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(168, 213, 186, 0.4);
    border-color: #8cc8a0;
}

.service-card-1:hover .service-name,
.service-card-1:hover .service-desc {
    color: white !important;
}

.service-card-1:hover .service-icon-box {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.service-card-2:hover {
    background: linear-gradient(135deg, #b3d4ff 0%, #9fc5ff 100%) !important;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(179, 212, 255, 0.4);
    border-color: #9fc5ff;
}

.service-card-2:hover .service-name,
.service-card-2:hover .service-desc {
    color: white !important;
}

.service-card-2:hover .service-icon-box {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.service-card-3:hover {
    background: linear-gradient(135deg, #ffd6a5 0%, #ffb86c 100%) !important;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(255, 214, 165, 0.4);
    border-color: #ffb86c;
}

.service-card-3:hover .service-name,
.service-card-3:hover .service-desc {
    color: white !important;
}

.service-card-3:hover .service-icon-box {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.service-card-4:hover {
    background: linear-gradient(135deg, #ffb3b3 0%, #ff9999 100%) !important;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(255, 179, 179, 0.4);
    border-color: #ff9999;
}

.service-card-4:hover .service-name,
.service-card-4:hover .service-desc {
    color: white !important;
}

.service-card-4:hover .service-icon-box {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.service-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #A0F0E8 0%, #7DD8D0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(160, 240, 232, 0.3);
}

.service-card .service-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.service-card .service-desc {
    font-size: 12px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

/* 서버 이전 안내 팝업 스타일 */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUpPopup 0.4s ease;
    overflow: hidden;
}

@keyframes slideUpPopup {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-header {
    background: linear-gradient(135deg, #A0F0E8 0%, #7DD8D0 100%);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h2 {
    margin: 0;
    color: #1a202c;
    font-size: 24px;
    font-weight: 600;
}

.popup-close {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    color: #1a202c;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.popup-body {
    padding: 32px;
}

.popup-main-text {
    font-size: 16px;
    color: #4a5568;
    margin-bottom: 24px;
    text-align: center;
}

.popup-info-box {
    background: linear-gradient(135deg, #f0fffe 0%, #e6fffa 100%);
    border: 2px solid #a0f0e8;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.popup-info-box p {
    margin: 8px 0;
    color: #2d3748;
    line-height: 1.8;
}

.info-title {
    font-size: 18px;
    margin-bottom: 12px !important;
}

.info-content {
    font-size: 15px;
    margin-bottom: 16px !important;
}

.highlight-text {
    font-size: 18px;
    font-weight: 600;
    color: #38b2ac;
    text-align: center;
    margin-top: 12px !important;
}


.popup-footer-text {
    text-align: center;
    color: #718096;
    font-size: 14px;
    margin-top: 16px;
}

.popup-footer {
    padding: 20px 32px;
    background: #f7fafc;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.popup-btn-primary {
    background: linear-gradient(135deg, #7dd8d0 0%, #5fc4bc 100%);
    color: white;
    border: none;
    padding: 12px 48px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(125, 216, 208, 0.4);
}

/* 반응형 디자인 */
@media (max-width: 640px) {
    .container {
        max-width: 100%;
        padding: 0 16px;
    }
    
    .service-grid-new {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .service-card {
        min-height: 140px;
        padding: 20px 12px;
    }
    
    .service-icon-box {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .auth-card {
        padding: 32px 24px;
        margin: 0;
        border-radius: 20px;
    }
    
    .auth-header h1 {
        font-size: 28px;
    }
    
    .auth-form h2 {
        font-size: 24px;
    }
    
    .form-group input,
    .form-group select {
        padding: 12px 14px;
        font-size: 15px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .service-button {
        padding: 16px;
        gap: 12px;
    }
    
    .service-icon {
        font-size: 28px;
        width: 44px;
        height: 44px;
    }
    
    .service-name {
        font-size: 16px;
    }
    
    .dashboard-footer {
        flex-direction: column;
    }
    
    .btn-secondary,
    .btn-outline {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .auth-card {
        padding: 24px 20px;
    }
    
    .auth-logo {
        width: 64px;
        height: 64px;
    }
    
    .service-grid {
        grid-template-columns: 1fr;
    }
}

/* Starry Background Animation */
.stars, .stars2, .stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stars {
    background: transparent;
    animation: animateStars 80s linear infinite;
}

.stars::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 40% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent);
    background-size: 200px 200px;
    background-repeat: repeat;
    opacity: 0.3;
}

.stars2 {
    background: transparent;
    animation: animateStars 120s linear infinite;
}

.stars2::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 10% 10%, white, transparent),
        radial-gradient(1px 1px at 30% 80%, white, transparent),
        radial-gradient(2px 2px at 60% 40%, white, transparent),
        radial-gradient(1px 1px at 70% 90%, white, transparent),
        radial-gradient(1px 1px at 95% 20%, white, transparent);
    background-size: 250px 250px;
    background-repeat: repeat;
    opacity: 0.2;
}

.stars3 {
    background: transparent;
    animation: animateStars 200s linear infinite;
}

.stars3::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 15% 45%, white, transparent),
        radial-gradient(1px 1px at 35% 25%, white, transparent),
        radial-gradient(1px 1px at 55% 75%, white, transparent),
        radial-gradient(2px 2px at 75% 55%, white, transparent),
        radial-gradient(1px 1px at 85% 85%, white, transparent);
    background-size: 300px 300px;
    background-repeat: repeat;
    opacity: 0.15;
}

@keyframes animateStars {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(50%);
    }
}

/* Twinkling effect */
@keyframes twinkle {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.4; }
}

.stars::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.8) 0%, transparent 2%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.8) 0%, transparent 2%),
        radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.6) 0%, transparent 1.5%),
        radial-gradient(circle at 90% 40%, rgba(255, 255, 255, 0.7) 0%, transparent 1.5%),
        radial-gradient(circle at 10% 80%, rgba(255, 255, 255, 0.6) 0%, transparent 2%);
    background-size: 400px 400px;
    animation: twinkle 4s ease-in-out infinite;
}