:root {
    --primary: #15803d;
    --primary-hover: #166534;
    --primary-light: #f0fdf4;
    --accent: #22c55e;
    --accent-dark: #15803d;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #f1f5f9;
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px -5px rgba(22, 163, 74, 0.12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8fafc;
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* App Container (Mobile & Desktop Responsive Shell) */
.app-shell {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.06);
    padding-bottom: 2rem;
}

@media (min-width: 768px) {
    body {
        padding: 20px 0;
        background: #f1f5f9;
    }
    .app-shell {
        border-radius: 32px;
        min-height: calc(100vh - 40px);
        border: 1px solid #e2e8f0;
    }
}

/* Status / Top Header */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-menu-btn {
    background: none;
    border: none;
    color: #15803d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 8px;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #15803d;
    letter-spacing: -0.02em;
}

.header-add-btn {
    width: 38px;
    height: 38px;
    background: #15803d;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.3);
    transition: var(--transition);
}

.header-add-btn:hover {
    transform: scale(1.08);
    background: #166534;
}

.btn-auth-login {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.btn-auth-login:hover {
    background: #16a34a;
    color: #ffffff;
}

.btn-auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.85rem;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    border-radius: 50px;
    font-size: 0.775rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.btn-auth-badge:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
}

.btn-auth-badge:hover .logout-text {
    color: #ef4444;
}

.logout-text {
    opacity: 0.75;
    font-weight: 500;
}

/* Main Content Area */
.app-content {
    padding: 0 1.25rem 1.5rem;
    flex: 1;
}

/* Hero "Multiple Links" Banner Card */
.hero-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.hero-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hero-badge-icon {
    width: 46px;
    height: 46px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.15);
    flex-shrink: 0;
}

.hero-info h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 2px;
}

.hero-info p {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.hero-graphic {
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-graphic svg {
    filter: drop-shadow(0 6px 12px rgba(22, 163, 74, 0.2));
}

/* Link Cards List */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.link-item-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 1;
}

.link-item-card.has-active-dropdown {
    z-index: 100 !important;
}

.link-item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: #dcfce7;
}

.link-item-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.link-brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.3rem;
    overflow: hidden;
}

.link-brand-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

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

.link-item-info h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-item-info p {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.link-item-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.btn-three-dots {
    background: none;
    border: none;
    color: #16a34a;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-three-dots:hover {
    background: #f0fdf4;
}

/* Quick Action Menu Popup */
.action-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    flex-direction: column;
    min-width: 150px;
    padding: 6px;
    overflow: hidden;
}

.action-dropdown.active {
    display: flex;
}

.dropdown-item {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    background: none;
    border: none;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: #f0fdf4;
    color: #15803d;
}

.dropdown-item.danger {
    color: #ef4444;
}

.dropdown-item.danger:hover {
    background: #fef2f2;
}

/* Search Bar Input */
.search-wrapper {
    margin-bottom: 1.25rem;
    position: relative;
}

.search-input-field {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-input-field:focus {
    background: #ffffff;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.search-field-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

/* File Upload Box Styling */
.file-upload-box {
    margin-top: 0.25rem;
}

.file-input-hidden {
    display: none;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-label:hover {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #15803d;
}

.image-preview-container {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: #f0fdf4;
    padding: 0.5rem 0.85rem;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.preview-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
    padding: 2px;
    border: 1px solid #cbd5e1;
}

.badge-mini {
    font-size: 0.65rem;
    font-weight: 700;
    background: #16a34a;
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 2px;
}

/* Admin Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 1.5rem;
    }
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #ffffff;
    border-radius: 28px 28px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

@media (min-width: 640px) {
    .modal-card {
        border-radius: 28px;
        transform: scale(0.95);
    }
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.btn-close {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.1rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus, .form-textarea:focus {
    background: #ffffff;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.icon-selector-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.6rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    max-height: 160px;
    overflow-y: auto;
}

.icon-option {
    padding: 0.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.icon-option:hover, .icon-option.selected {
    border-color: #16a34a;
    background: #f0fdf4;
}

.btn-submit {
    width: 100%;
    background: #15803d;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.85rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25);
    margin-top: 0.5rem;
}

.btn-submit:hover {
    background: #166534;
}

/* Custom Delete Confirmation Modal */
.delete-modal-card {
    padding: 2rem 1.75rem;
    text-align: center;
    align-items: center;
    max-width: 420px;
    border-radius: 28px !important;
}

.delete-icon-badge {
    width: 60px;
    height: 60px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.delete-modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.delete-modal-desc {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.45;
    margin-bottom: 1.75rem;
}

.delete-modal-desc strong {
    color: #0f172a;
}

.delete-modal-actions {
    display: flex;
    gap: 0.85rem;
    width: 100%;
}

.btn-delete-cancel {
    flex: 1;
    padding: 0.85rem;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete-cancel:hover {
    background: #e2e8f0;
}

.btn-delete-confirm {
    flex: 1;
    padding: 0.85rem;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: var(--transition);
}

.btn-delete-confirm:hover {
    background: #dc2626;
}
