* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a6fd8;
    --secondary: #764ba2;
    --accent: #f093fb;
    --text: #2d3748;
    --text-light: #718096;
    --background: #f7fafc;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 24px;
    color: var(--white);
    padding: 20px 0;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Card Styles */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:active {
    transform: translateY(2px);
}

.card-header {
    padding: 20px 20px 0;
    margin-bottom: 0;
}

.card-header h2 {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 0;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

input, textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 16px; /* Prevent zoom on iOS */
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--white);
    -webkit-appearance: none;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

input {
    height: 52px;
}

textarea {
    height: 140px;
    resize: vertical;
    line-height: 1.5;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    height: 52px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover, .btn-primary:focus {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
    padding: 12px 20px;
    font-size: 14px;
    width: auto;
    height: auto;
}

.btn-danger:active {
    transform: translateY(1px);
}

/* Entries List */
.entries-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.entry-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: all 0.2s ease;
    position: relative;
}

.entry-item:active {
    transform: scale(0.98);
}

.entry-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.entry-title {
    font-weight: 700;
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1.3;
}

.entry-date {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.entry-content {
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.entry-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* Loading and States */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-style: italic;
}

.error {
    background: #fed7d7;
    color: #c53030;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    border-left: 4px solid #e53e3e;
}

/* Message Toast */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: var(--radius);
    z-index: 1000;
    font-weight: 600;
    text-align: center;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
}

.message.success {
    background: #48bb78;
    color: white;
}

.message.error {
    background: #e53e3e;
    color: white;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state p {
    font-size: 0.875rem;
}

/* Floating Action Button for Mobile */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.fab:active {
    transform: scale(0.9);
}

/* Form Section Toggle */
.form-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 99;
    max-height: 80vh;
    overflow-y: auto;
}

.form-section.active {
    transform: translateY(0);
}

.form-section .card-header {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-form {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    -webkit-tap-highlight-color: transparent;
}

/* Backdrop */
.backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 24px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .form-section {
        position: static;
        transform: none;
        box-shadow: var(--shadow-lg);
        border-radius: var(--radius);
        max-height: none;
        margin-bottom: 24px;
    }
    
    .fab {
        display: none;
    }
    
    .backdrop {
        display: none;
    }
    
    .entry-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .btn {
        width: auto;
        padding: 12px 32px;
    }
}

/* Large Desktop */
@media (min-width: 1024px) {
    .container {
        max-width: 700px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #e2e8f0;
        --text-light: #a0aec0;
        --background: #1a202c;
        --white: #2d3748;
    }
    
    input, textarea {
        background: #4a5568;
        border-color: #4a5568;
        color: var(--text);
    }
    
    input::placeholder, textarea::placeholder {
        color: #a0aec0;
    }
}