/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    background-color: #fff;
    position: relative;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #4a6baf;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

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

/* Main Content */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 60px; /* Space for bottom nav */
}

.view {
    padding: 1rem;
}

.view.hidden {
    display: none;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.view-header h2 {
    font-size: 1.2rem;
    color: #333;
}

/* Search */
.search-container {
    padding: 1rem;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 1rem;
    background-color: white;
}

/* Card Lists */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-icon {
    font-size: 1.5rem;
}

.card-content {
    font-size: 0.9rem;
    color: #666;
    white-space: pre-wrap;
    word-break: break-word;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #888;
}

/* Buttons */
.btn-primary {
    background-color: #4a6baf;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #3a5a9f;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-danger:hover {
    background-color: #d62c1a;
}

.btn-back {
    background: none;
    border: none;
    color: #4a6baf;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background-color: white;
    border-top: 1px solid #eee;
    z-index: 10;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-btn.active {
    color: #4a6baf;
}

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

.nav-label {
    font-size: 0.7rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background-color: white;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.modal-content {
    padding: 1rem;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #eee;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Settings */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.setting-item label {
    font-weight: 500;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 50;
    transition: opacity 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Dark theme */
body.dark-theme {
    background-color: #222;
    color: #eee;
}

body.dark-theme #app {
    background-color: #333;
}

body.dark-theme .app-header {
    background-color: #1a2a5a;
}

body.dark-theme .card {
    background-color: #444;
    color: #eee;
}

body.dark-theme .search-container {
    background-color: #333;
    border-bottom-color: #555;
}

body.dark-theme .search-input {
    background-color: #444;
    border-color: #555;
    color: #eee;
}

body.dark-theme .bottom-nav {
    background-color: #333;
    border-top-color: #555;
}

body.dark-theme .modal {
    background-color: #444;
    color: #eee;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: #555;
}

body.dark-theme .form-group input,
body.dark-theme .form-group textarea,
body.dark-theme .form-group select {
    background-color: #555;
    border-color: #666;
    color: #eee;
}

body.dark-theme .setting-item {
    border-bottom-color: #555;
}

/* Responsive adjustments */
@media (min-width: 480px) {
    #app {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
}