:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.app-header {
    text-align: center;
    padding: 8px 0;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #a5b4fc, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Card base */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

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

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Forms */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group input {
    background: #0f172a !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #ffffff !important;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
    background: #090d16 !important;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Autofill override to keep dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #0f172a inset !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Active Groups Section */
.group-list-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title-area h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    background: var(--accent);
    color: white;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.groups-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Group Card Item */
.group-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.group-item-card:hover {
    transform: translateX(4px);
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(30, 41, 59, 0.9);
}

.group-info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.group-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.group-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.go-arrow {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.group-item-card:hover .go-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* Loading & Empty State */
.loading-state, .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

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

.app-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: auto;
}

@media (max-width: 480px) {
    .app-container {
        padding: 16px 12px;
    }
}

/* Toast styling */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    min-width: 250px;
    max-width: 350px;
    backdrop-filter: blur(8px);
    transform: translateY(-20px);
    opacity: 0;
    animation: toast-in 0.3s forwards, toast-out 0.3s 2.7s forwards;
    pointer-events: auto;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes toast-in {
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
    to { transform: translateY(-20px); opacity: 0; }
}

.group-item-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.delete-group-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    height: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-group-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.05);
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: var(--transition);
}

.modal-content {
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: scale-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scale-up {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}
