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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f3f4f6;
    --dark: #1f2937;
    --text: #374151;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: white;
}

body {
    display: flex;
    flex-direction: column;
    background-color: #f9fafb;
    color: var(--text);
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 0.75rem;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.icon-button:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 5rem;
}

.container {
    max-width: 100%;
    padding: 1rem;
}

.container-no-padding {
    padding: 0 !important;
}

/* No padding for full-width pages */
body.full-width .container {
    padding: 0 !important;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.95rem;
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background-color: white;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
    resize: vertical;
    min-height: 6rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 0.5rem;
    width: 100%;
    white-space: nowrap;
}

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

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--light);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:active {
    background: #e5e7eb;
    transform: scale(0.98);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:active {
    background: #dc2626;
    transform: scale(0.98);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:active {
    background: #059669;
    transform: scale(0.98);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    width: auto;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

.card-body {
    color: var(--text);
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-danger {
    background-color: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background-color: #fef3c7;
    color: #78350f;
    border: 1px solid #fcd34d;
}

.alert-info {
    background-color: #dbeafe;
    color: #0c2340;
    border: 1px solid #93c5fd;
}

/* Footer Navigation */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    z-index: 50;
    max-width: 100%;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    border: none;
    background: none;
}

.nav-item:active {
    background: var(--light);
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* List */
.list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    transition: background 0.3s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:active {
    background: var(--light);
}

/* Text utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: #9ca3af;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem 1rem 0 0;
    padding: 1.5rem;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Responsive Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--light);
    color: var(--dark);
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-danger {
    background: var(--danger);
    color: white;
}

/* Stats */
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
}

a:active {
    opacity: 0.8;
}

/* Safe area */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

@media (max-height: 600px) {
    .content {
        padding-bottom: 6rem;
    }
}

