/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

/* ===== PAGES ===== */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.page.active {
    display: block;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 12px 24px;
    color: #c9d1d9;
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid #7ee787;
}
.toast.error {
    border-left: 4px solid #f85149;
}
.toast.info {
    border-left: 4px solid #58a6ff;
}

/* ============================================================ */
/* LOGIN PAGE                                                    */
/* ============================================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #161b22 0%, #0d1117 100%);
}

.login-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.logo-icon {
    font-size: 48px;
    color: #58a6ff;
    margin-bottom: 16px;
}

.login-box h1 {
    font-size: 32px;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 8px;
}

.login-box .tagline {
    color: #8b949e;
    font-size: 16px;
    margin-bottom: 32px;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #ffffff;
    color: #24292f;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.btn-google:hover {
    background: #f0f0f0;
}

.btn-google i {
    font-size: 20px;
    color: #4285f4;
}

.login-note {
    margin-top: 24px;
    font-size: 13px;
    color: #8b949e;
}

/* ============================================================ */
/* DASHBOARD HEADER                                              */
/* ============================================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 24px 0;
    border-bottom: 1px solid #30363d;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    font-size: 28px;
    color: #58a6ff;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    color: #f0f6fc;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-email {
    font-size: 14px;
    color: #8b949e;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #30363d;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: #238636;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2ea043;
}

.btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #30363d;
}

.btn-danger {
    background: #da3633;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #f85149;
}

.btn-logout {
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: #f85149;
    border-color: #f85149;
}

.btn-copy {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: #30363d;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 2;
    min-width: 200px;
    display: flex;
    align-items: center;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 0 12px;
}

.search-input-wrapper i {
    color: #8b949e;
    margin-right: 8px;
}

#search-input {
    background: transparent;
    border: none;
    color: #c9d1d9;
    padding: 10px 0;
    width: 100%;
    outline: none;
    font-size: 14px;
}

#search-input::placeholder {
    color: #484f58;
}

#language-filter,
#tag-filter {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    min-width: 140px;
}

#tag-filter::placeholder {
    color: #484f58;
}

/* ===== SNIPPET GRID ===== */
.snippet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.snippet-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
    display: flex;
    flex-direction: column;
}

.snippet-card:hover {
    border-color: #58a6ff;
}

.snippet-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #f0f6fc;
    margin-bottom: 6px;
}

.snippet-card-language {
    display: inline-block;
    background: #1f2937;
    color: #58a6ff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    margin-bottom: 10px;
    align-self: flex-start;
}

.snippet-card-description {
    color: #8b949e;
    font-size: 14px;
    flex: 1;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.snippet-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.snippet-card-tag {
    background: #21262d;
    color: #8b949e;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
}

.snippet-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #484f58;
    border-top: 1px solid #21262d;
    padding-top: 12px;
    margin-top: auto;
}

.snippet-card-actions {
    display: flex;
    gap: 8px;
}

.snippet-card-actions button {
    background: transparent;
    border: none;
    color: #484f58;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s;
    font-size: 14px;
}

.snippet-card-actions .btn-edit-card:hover {
    color: #58a6ff;
}
.snippet-card-actions .btn-delete-card:hover {
    color: #f85149;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #8b949e;
}

.empty-state i {
    font-size: 48px;
    color: #30363d;
    margin-bottom: 16px;
}
.empty-state h2 {
    font-weight: 400;
    color: #c9d1d9;
}

/* ============================================================ */
/* FORM PAGE                                                     */
/* ============================================================ */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 32px;
}

.form-container h2 {
    margin-bottom: 24px;
    color: #f0f6fc;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #c9d1d9;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 10px 12px;
    color: #c9d1d9;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #58a6ff;
}

.form-group textarea {
    resize: vertical;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    padding-top: 18px;
    border-top: 1px solid #21262d;
}

/* ============================================================ */
/* DETAIL PAGE                                                   */
/* ============================================================ */
.detail-container {
    max-width: 900px;
    margin: 0 auto;
}

#btn-detail-back {
    margin-bottom: 24px;
}

.detail-header {
    margin-bottom: 24px;
}

#detail-title {
    font-size: 32px;
    color: #f0f6fc;
    margin-bottom: 8px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 12px;
}

.badge-language {
    background: #1f2937;
    color: #58a6ff;
    padding: 2px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-tags .tag-pill {
    background: #21262d;
    color: #8b949e;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.detail-description {
    font-size: 16px;
    margin-bottom: 24px;
    color: #c9d1d9;
    background: #0d1117;
    padding: 16px;
    border-radius: 6px;
    border-left: 3px solid #58a6ff;
}

.code-wrapper {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    font-size: 13px;
    color: #8b949e;
}

.code-wrapper pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-wrapper code {
    font-family: 'Courier New', Courier, 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
    }
    .header-right {
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .search-bar {
        flex-direction: column;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .snippet-grid {
        grid-template-columns: 1fr;
    }
    .detail-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .login-box {
        padding: 32px 20px;
    }
}