/* ============================================
   LinkBatu - CSS
   ============================================ */

:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --text: #e0e0e0;
    --text-muted: #888;
    --border: #2a2a4a;
    --success: #00b894;
    --error: #e74c3c;
    --warning: #f39c12;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: rgba(0, 184, 148, 0.15); color: var(--success); border: 1px solid rgba(0, 184, 148, 0.3); }
.alert-error { background: rgba(231, 76, 60, 0.15); color: var(--error); border: 1px solid rgba(231, 76, 60, 0.3); }
.alert-warning { background: rgba(243, 156, 18, 0.15); color: var(--warning); border: 1px solid rgba(243, 156, 18, 0.3); }

/* ============================================
   AUTH LAYOUT
   ============================================ */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 40px 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-muted);
    margin-top: 8px;
    font-size: 14px;
}

.auth-form .form-group { margin-bottom: 20px; }

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a { color: var(--primary); font-weight: 600; }

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-group input.is-error {
    border-color: var(--error);
}

.error-text {
    display: block;
    font-size: 12px;
    color: var(--error);
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-block { width: 100%; }

.btn-sm { padding: 8px 12px; font-size: 13px; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg-input);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: transparent;
    border: 1px solid transparent;
    color: var(--error);
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-input);
    color: var(--text);
}

.nav-link.logout {
    color: var(--error);
}

.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 60px);
}

/* ============================================
   DASHBOARD
   ============================================ */
.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(108, 92, 231, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; }

.stat-value {
    font-size: 18px;
    font-weight: 700;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   LINKS PAGE
   ============================================ */
.links-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .links-layout {
        grid-template-columns: 1fr;
    }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-muted);
}

.link-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s;
}

.link-item:hover {
    border-color: var(--primary);
}

.link-item.dragging {
    opacity: 0.5;
}

.link-item.drag-over {
    border-color: var(--primary);
    border-style: dashed;
}

.link-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 4px;
    flex-shrink: 0;
}

.link-drag-handle:active { cursor: grabbing; }

.link-content { flex: 1; min-width: 0; }

.link-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.link-url {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.link-meta i { margin-right: 3px; }

.link-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.inline-form { display: inline; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-inactive {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
}

.add-link-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: sticky;
    top: 80px;
}

.add-link-form h3 {
    font-size: 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.open { display: block; }

.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    max-width: 480px;
    margin: 80px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    z-index: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ============================================
   PROFILE LAYOUT (Public)
   ============================================ */
.profile-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    padding: 40px 20px;
}

.profile-container {
    width: 100%;
    max-width: 580px;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px;
}

.profile-avatar { margin-bottom: 16px; }

.profile-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: #fff;
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-bio {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.profile-link:hover {
    border-color: var(--primary);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.15);
}

.link-arrow {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.profile-link:hover .link-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

.profile-footer {
    text-align: center;
    margin-top: 40px;
}

.powered-by {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.6;
}

.powered-by:hover {
    opacity: 1;
    color: var(--text-muted);
}
