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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding: 20px;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    padding: 30px 20px;
    text-align: center;
    color: white;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
}

/* Header with user info */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

#user-email {
    font-size: 12px;
    opacity: 0.8;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    font-size: 12px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
    transform: none;
    box-shadow: none;
}

main {
    padding: 0 20px 30px 20px;
}

/* Navigation */
.view-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.nav-btn {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.nav-btn.active {
    color: #ff6b6b;
    border-bottom-color: #ff6b6b;
    background: white;
}

.nav-btn:hover:not(.active) {
    background: #f1f3f4;
}

.nav-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

.today-view, .calendar-view {
    padding: 30px 0;
}

/* Authentication View */
.auth-section {
    padding: 40px 30px;
    text-align: center;
}

.auth-content h2 {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.auth-content p {
    color: #666;
    margin-bottom: 30px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

#email-input {
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

#email-input:focus {
    border-color: #667eea;
}

.btn-auth {
    background: #667eea;
    color: white;
}

.btn-auth:hover {
    background: #5a6fd8;
}

.btn-auth:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.auth-status {
    min-height: 20px;
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-status.success {
    color: #28a745;
}

.auth-status.error {
    color: #dc3545;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 30px 0;
    color: #999;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9ecef;
}

.auth-divider span {
    background: white;
    padding: 0 15px;
    position: relative;
}

/* Auth method toggle */
.auth-toggle {
    display: flex;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 30px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Auth method forms */
.auth-method {
    display: none;
}

.auth-method.active {
    display: block;
}

.auth-form input {
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease;
}

.auth-form input:focus {
    border-color: #667eea;
}

/* Auth switch links */
.auth-switch {
    color: #666;
    font-size: 14px;
    margin-top: 15px;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-guest {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e9ecef;
}

.btn-guest:hover {
    background: #e9ecef;
    transform: none;
    box-shadow: none;
}

.guest-note {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.today-section {
    text-align: center;
    margin-bottom: 40px;
}

#today-date {
    font-size: 20px;
    font-weight: 600;
    color: #666;
    margin-bottom: 30px;
}

.poop-status {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px 20px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

.status-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.status-text {
    font-size: 18px;
    font-weight: 600;
    color: #666;
}

.poop-status.yes {
    background: #d4edda;
    border-color: #c3e6cb;
}

.poop-status.yes .status-text {
    color: #155724;
}

.poop-status.no {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.poop-status.no .status-text {
    color: #856404;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-yes {
    background: #28a745;
    color: white;
}

.btn-yes:hover {
    background: #218838;
}

.btn-no {
    background: #ffc107;
    color: #333;
}

.btn-no:hover {
    background: #e0a800;
}

.btn-reset {
    background: #6c757d;
    color: white;
    font-size: 14px;
    padding: 10px 15px;
}

.btn-reset:hover {
    background: #545b62;
}

.history-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #666;
    text-align: center;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.history-date {
    font-weight: 500;
    color: #666;
}

.history-status {
    font-size: 20px;
}

.history-status.yes {
    color: #28a745;
}

.history-status.no {
    color: #ffc107;
}

/* Calendar View */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.nav-arrow {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-arrow:hover {
    background: #f8f9fa;
    color: #ff6b6b;
}

#calendar-month-year {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 30px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.calendar-day.header {
    background: #f8f9fa;
    color: #666;
    font-weight: 600;
    cursor: default;
}

.calendar-day.other-month {
    color: #ccc;
}

.calendar-day.today {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.calendar-day.poop-yes {
    background: #d4edda;
    color: #155724;
}

.calendar-day.poop-yes::after {
    content: '✅';
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
}

.calendar-day.poop-no {
    background: #fff3cd;
    color: #856404;
}

.calendar-day.poop-no::after {
    content: '⏰';
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
}

.calendar-day:hover:not(.header):not(.other-month) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

.calendar-day:not(.header):not(.other-month) {
    cursor: pointer;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.legend-dot.poop-yes {
    background: #d4edda;
    border-color: #c3e6cb;
}

.legend-dot.poop-no {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.legend-dot.poop-none {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.share-section {
    text-align: center;
}

.btn-share {
    background: #667eea;
    color: white;
}

.btn-share:hover {
    background: #5a6fd8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #666;
}

.modal-body {
    padding: 0 20px 20px 20px;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn-share-option {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e9ecef;
    padding: 12px 15px;
    font-size: 16px;
}

.btn-share-option:hover {
    background: #e9ecef;
    transform: none;
    box-shadow: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes celebrationPulse {
    0% {
        transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Day Editor Modal */
.day-editor-content {
    text-align: center;
}

.day-editor-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    margin-top: 25px;
}

.day-editor-content h4:first-of-type {
    margin-top: 0;
}

#day-editor-date {
    font-size: 18px;
    font-weight: 600;
    color: #666;
    margin-bottom: 20px;
}

.day-editor-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.time-input {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    width: 150px;
    margin: 0 auto;
    display: block;
}

.time-input:focus {
    outline: none;
    border-color: #667eea;
}

#day-editor-notes-text {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

#day-editor-notes-text:focus {
    outline: none;
    border-color: #667eea;
}

#day-editor-notes-text::placeholder {
    color: #999;
}

footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 14px;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    header {
        padding: 25px 15px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .user-info {
        align-items: center;
    }
    
    .auth-section {
        padding: 30px 20px;
    }
    
    main {
        padding: 0 15px 25px 15px;
    }
    
    .view {
        padding: 25px 0;
    }
    
    .calendar-grid {
        gap: 4px;
    }
    
    .calendar-day {
        font-size: 12px;
    }
    
    .legend-item {
        font-size: 12px;
    }
    
    .calendar-legend {
        gap: 15px;
    }
    
    .poop-status {
        padding: 25px 15px;
    }
    
    .status-icon {
        font-size: 50px;
    }
    
    .btn {
        padding: 12px 15px;
        font-size: 16px;
    }
}

/* Sharing-specific styles */
.shared-view {
    padding: 25px;
}

.shared-section h2 {
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

.shared-with-me, .my-shares {
    margin-bottom: 30px;
}

.shared-with-me h3, .my-shares h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 18px;
}

.shared-calendars-list, .my-shares-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shared-calendar-item, .my-share-item {
    background: #f8f9ff;
    border: 1px solid #e1e5f2;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.2s ease;
}

.shared-calendar-item:hover, .my-share-item:hover {
    background: #f0f2ff;
    border-color: #667eea;
    cursor: pointer;
}

.shared-calendar-item h4, .my-share-item h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.shared-calendar-item p, .my-share-item p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.my-share-item .share-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
}

.share-status.pending {
    background: #fef3cd;
    color: #856404;
}

.share-status.accepted {
    background: #d1edff;
    color: #004085;
}

.share-status.declined {
    background: #f8d7da;
    color: #721c24;
}

.share-status.revoked {
    background: #e2e3e5;
    color: #383d41;
}

.btn-invite {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: 10px;
}

.btn-invite:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Form styles for invite modal */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.status-message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-weight: 600;
}

.status-message.success {
    background: #d1edff;
    color: #004085;
    border: 1px solid #bee5eb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Shared calendar info */
.shared-calendar-info {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.shared-calendar-info h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.shared-calendar-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.shared-calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.shared-calendar-nav h4 {
    margin: 0;
    color: #333;
}

/* Empty state styles */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Mobile adjustments for sharing */
@media (max-width: 480px) {
    .modal-content.modal-large {
        max-width: 95%;
        margin: 5% auto;
    }

    .shared-view {
        padding: 15px;
    }

    .btn-invite {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .share-section {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .share-section .btn {
        width: 100%;
    }
}