/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #0f172a;
    --bg-light: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   로그인 화면
   ============================================ */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 50px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    animation: slideUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 2em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95em;
}

.login-input-group {
    margin-bottom: 25px;
}

.login-input-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
}

.login-input-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-light);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.login-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.login-input-group input::placeholder {
    color: var(--text-muted);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

/* 로그아웃 버튼 */
.btn-logout {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 0.85em;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.9);
}

/* 카드 스타일 */
.input-card, .result-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.input-card:hover {
    transform: translateY(-5px);
}

.input-card h2, .result-card h3 {
    margin-bottom: 25px;
    color: var(--text-primary);
    font-size: 1.8em;
}

/* 입력 그룹 */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9em;
}

.required {
    color: var(--error-color);
    font-weight: 500;
    font-size: 0.85em;
}

input[type="url"],
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-light);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input[type="url"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="url"]::placeholder,
input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-muted);
}

/* 커스텀 별칭 컨테이너 */
.custom-alias-container {
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
    overflow: hidden;
    transition: all 0.3s ease;
}

.custom-alias-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.domain-prefix {
    padding: 15px 15px 15px 20px;
    background: var(--bg-color);
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border-right: 2px solid var(--border-color);
    white-space: nowrap;
}

.custom-alias-container input {
    border: none;
    background: transparent;
    padding: 15px 20px;
    flex: 1;
}

.custom-alias-container input:focus {
    box-shadow: none;
}

.help-text {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.85em;
}

/* 버튼 스타일 */
.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.btn-icon:hover {
    transform: rotate(180deg);
}

.btn-copy {
    background: transparent;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
    transition: transform 0.2s ease;
}

.btn-copy:hover {
    transform: scale(1.2);
}

.btn-loading {
    display: none;
}

/* 결과 카드 */
.result-card {
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    text-align: center;
    margin-bottom: 30px;
}

.result-header h3 {
    color: var(--success-color);
}

.url-display {
    margin-bottom: 20px;
}

.url-display label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
}

.url-box {
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.original-url {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.short-url {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1em;
}

.arrow-down {
    text-align: center;
    font-size: 2em;
    margin: 15px 0;
}

.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.result-actions button {
    flex: 1;
    min-width: 150px;
}

/* 알림 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-icon {
    font-size: 1.5em;
}

/* URL 목록 */
.urls-section {
    margin-top: 50px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    color: var(--text-primary);
    font-size: 1.8em;
}

.urls-list {
    display: grid;
    gap: 20px;
}

.url-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 25px;
    transition: all 0.3s ease;
}

.url-item:hover {
    transform: translateX(5px);
    border-color: var(--primary-color);
}

.url-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.url-item-info h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.2em;
    word-break: break-all;
}

.url-item-original {
    color: var(--text-muted);
    font-size: 0.9em;
    word-break: break-all;
}

.url-item-meta {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85em;
}

.url-item-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.btn-delete:hover {
    background: var(--error-color);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.empty-state-sub {
    font-size: 0.95em;
}

/* 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.5em;
    color: var(--text-primary);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 2em;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.btn-close:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 25px;
}

.stats-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.stats-item:last-child {
    border-bottom: none;
}

.stats-item label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: 600;
}

.stats-item-value {
    color: var(--text-primary);
    font-size: 1.1em;
    word-break: break-all;
}

.stats-highlight {
    color: var(--primary-color);
    font-size: 2em;
    font-weight: 700;
}

.click-history {
    margin-top: 20px;
}

.click-item {
    background: var(--bg-light);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* 푸터 */
.footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* 반응형 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .input-card, .result-card {
        padding: 25px;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions button {
        width: 100%;
    }

    .url-item-header {
        flex-direction: column;
        gap: 15px;
    }

    .url-item-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-small {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: start;
        gap: 15px;
    }

    .domain-prefix {
        font-size: 12px;
        padding: 15px 10px;
    }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
