/* ============================================
   Git Terrarium - Styles
   ============================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
}

/* Canvas Container */
#canvas-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

/* UI Overlay Base */
.ui-overlay {
    position: fixed;
    z-index: 100;
    pointer-events: none;
}

/* ============================================
   Title Card
   ============================================ */
.title-card {
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    max-width: 320px;
    transition: all 0.3s ease;
}

.title-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.title-text {
    flex: 1;
}

.title-toggle-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #666;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.title-toggle-btn:hover {
    background: #e0e0e0;
}

.title-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    max-height: 500px;
    opacity: 1;
    margin-top: 15px;
}

.title-card.minimized .title-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.title-card.minimized {
    padding: 15px 20px;
}

.title-card.minimized .subtitle {
    margin-bottom: 0;
}

.title-card.minimized .title-toggle-btn .toggle-icon {
    transform: rotate(180deg);
}

.title-card h1 {
    font-size: 1.4rem;
    color: #2e7d32;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-card h1::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #81c784, #4caf50);
    border-radius: 6px;
    flex-shrink: 0;
}

.title-card .subtitle {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0;
    transition: margin-bottom 0.3s ease;
}

/* ============================================
   Search Form
   ============================================ */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: #81c784;
    box-shadow: 0 0 0 3px rgba(129, 199, 132, 0.2);
}

.search-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, #66bb6a, #4caf50);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

.search-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================
   Token Input
   ============================================ */
.token-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #888;
    cursor: pointer;
    user-select: none;
}

.token-toggle input {
    accent-color: #4caf50;
}

.token-input-wrapper {
    display: none;
    margin-top: 5px;
}

.token-input-wrapper.show {
    display: block;
}

.token-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: monospace;
    outline: none;
}

.token-input:focus {
    border-color: #81c784;
}

.token-hint {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 5px;
    line-height: 1.4;
}

.token-hint a {
    color: #4caf50;
}

/* ============================================
   GitHub OAuth Button
   ============================================ */
.auth-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.github-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: #24292e;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.github-btn:hover {
    background: #2f363d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.github-btn:active {
    transform: translateY(0);
    background: #1b1f23;
}

.github-btn svg {
    flex-shrink: 0;
}

.github-btn.logout-btn {
    background: #6a737d;
    margin-top: 8px;
}

.github-btn.logout-btn:hover {
    background: #586069;
}

.login-status {
    margin-top: 10px;
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-status.logged-in {
    color: #2e7d32;
    font-weight: 500;
}

.auth-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.auth-hint {
    margin-top: 8px;
    font-size: 0.65rem;
    color: #aaa;
    line-height: 1.5;
    text-align: center;
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* ============================================
   Current User Display
   ============================================ */
.current-user {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    display: none;
}

.current-user.show {
    display: block;
}

.current-user-label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.current-user-name {
    font-size: 1rem;
    color: #2e7d32;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

.current-user-name img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* ============================================
   Legend Card
   ============================================ */
.legend-card {
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

.legend-card h3 {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.legend-items {
    display: flex;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #666;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ============================================
   Stats Card
   ============================================ */
.stats-card {
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    min-width: 160px;
    transition: all 0.3s ease;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.stats-toggle-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #666;
    transition: all 0.2s ease;
}

.stats-toggle-btn:hover {
    background: #e0e0e0;
}

.stats-toggle-btn .toggle-icon {
    transition: transform 0.3s ease;
}

.stats-card.collapsed .stats-toggle-btn .toggle-icon {
    transform: rotate(180deg);
}

.stats-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    max-height: 300px;
    opacity: 1;
    margin-top: 10px;
}

.stats-card.collapsed .stats-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.stats-card h3 {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.stat-label {
    color: #888;
}

.stat-value {
    color: #2e7d32;
    font-weight: 600;
}

/* ============================================
   Year Selector
   ============================================ */
.year-selector {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.year-selector label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
}

.year-selector select {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.year-selector select:focus {
    border-color: #81c784;
}

/* ============================================
   Loading Screen
   ============================================ */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #c8e6c9;
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 20px;
    color: #2e7d32;
    font-size: 0.95rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Info Bar (Time & Weather)
   ============================================ */
.info-bar {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    color: #333;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-item:not(:last-child)::after {
    content: '';
    width: 1px;
    height: 16px;
    background: #ddd;
    margin-left: 10px;
}

/* ============================================
   Controls Hint
   ============================================ */
.controls-hint {
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    font-size: 0.7rem;
    color: #aaa;
    pointer-events: auto;
}

.controls-hint span {
    display: block;
    margin-bottom: 3px;
}

.controls-hint span:last-child {
    margin-bottom: 0;
}

/* ============================================
   Error Toast
   ============================================ */
.error-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(244, 67, 54, 0.95);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 0.9rem;
    z-index: 2000;
    display: none;
    text-align: center;
    max-width: 400px;
}

.error-toast.show {
    display: block;
    animation: shake 0.5s ease;
}

.error-toast h4 {
    margin-bottom: 8px;
}

.error-toast p {
    font-size: 0.8rem;
    opacity: 0.9;
}

.error-toast button {
    margin-top: 12px;
    padding: 8px 20px;
    background: white;
    color: #f44336;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%); }
    20%, 60% { transform: translate(-52%, -50%); }
    40%, 80% { transform: translate(-48%, -50%); }
}

/* ============================================
   Welcome Screen
   ============================================ */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 500;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.welcome-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.welcome-content {
    text-align: center;
    max-width: 450px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #81c784, #4caf50);
    border-radius: 20px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.welcome-content h1 {
    font-size: 2rem;
    color: #2e7d32;
    margin-bottom: 10px;
}

.welcome-content p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.welcome-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.welcome-form input {
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.welcome-form input:focus {
    border-color: #81c784;
}

.welcome-form button {
    padding: 14px 24px;
    background: linear-gradient(135deg, #66bb6a, #4caf50);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.welcome-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
}

.demo-link {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #888;
}

.demo-link a {
    color: #4caf50;
    cursor: pointer;
    text-decoration: underline;
}

.privacy-notice {
    margin-top: 20px;
    font-size: 0.75rem;
    color: #999;
    line-height: 1.6;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.privacy-notice strong {
    color: #666;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .title-card {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 12px 15px;
    }

    .title-card h1 {
        font-size: 1.1rem;
    }

    /* 모바일에서 title-card 기본적으로 최소화 */
    .title-card.minimized {
        padding: 10px 15px;
    }

    .stats-card {
        top: auto;
        bottom: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        padding: 12px 15px;
    }

    /* 모바일에서 stats-card 기본적으로 접힘 */
    .stats-card.collapsed {
        padding: 10px 15px;
    }

    .legend-card {
        display: none;
    }

    .controls-hint {
        display: none;
    }

    .welcome-content {
        margin: 20px;
        padding: 30px 20px;
    }

    .info-bar {
        top: auto;
        bottom: 70px;
        font-size: 0.75rem;
        padding: 6px 12px;
    }
}

/* ============================================
   Contribution Tooltip
   ============================================ */
.contribution-tooltip {
    position: fixed;
    z-index: 1000;
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 200px;
}

.contribution-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.contribution-tooltip .tooltip-date {
    font-weight: 600;
    margin-bottom: 4px;
    color: #a5d6a7;
}

.contribution-tooltip .tooltip-count {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.contribution-tooltip .tooltip-level {
    font-size: 0.75rem;
    color: #9e9e9e;
}
