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

:root {
    --primary-color: #2c5282;
    --primary-dark: #1a365d;
    --primary-light: #4299e1;
    --accent-color: #ed8936;
    --success-color: #48bb78;
    --danger-color: #e53e3e;
    --text-color: #2d3748;
    --text-light: #718096;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --star-color: #ecc94b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

header .tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

#nav-auth {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    margin-top: 2rem;
}

#nav-auth .user-greeting {
    margin-right: 1rem;
}

/* Auth footer buttons */
.auth-footer .btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.auth-footer .btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: #dd6b20;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-color);
}

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

.btn-outline {
    background-color: transparent;
    border: 2px solid white;
    color: white;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

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

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

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* Info box */
.info-box {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary-color);
}

.info-box h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-box ul {
    list-style: none;
    margin-top: 1rem;
}

.info-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-box li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* Auth section */
.auth-container {
    max-width: 450px;
    margin: 0 auto 2rem;
}

.auth-form {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-form h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-help {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Rating input */
.rating-input {
    display: flex;
    gap: 0.25rem;
}

.rating-input .star {
    font-size: 1.75rem;
    color: var(--border-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.rating-input .star:hover,
.rating-input .star.active {
    color: var(--star-color);
}

/* Add tip section */
#add-tip-section {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#add-tip-section h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Tips section */
#tips-section {
    margin-bottom: 3rem;
}

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

.section-header h2 {
    color: var(--primary-color);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-controls label {
    color: var(--text-light);
    font-size: 0.9rem;
}

.filter-controls select {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Tips grid */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.tip-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tip-card.has-cover {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
}

.tip-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tip-cover {
    flex-shrink: 0;
    width: 120px;
}

.tip-cover img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tip-content {
    flex: 1;
    min-width: 0;
}

.tip-card:not(.has-cover) .tip-content {
    /* For cards without cover, content takes full width */
}

.tip-isbn {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.tip-isbn a {
    color: var(--primary-color);
    text-decoration: none;
}

.tip-isbn a:hover {
    text-decoration: underline;
}

.tip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.tip-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 0;
}

.tip-genre {
    background-color: var(--primary-light);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tip-author {
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.tip-rating {
    color: var(--star-color);
    margin-bottom: 0.75rem;
}

.tip-description {
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.tip-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

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

/* Loading and empty states */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.no-tips {
    text-align: center;
    padding: 3rem;
    background-color: var(--card-bg);
    border-radius: 12px;
    color: var(--text-light);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-color);
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

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

.toast.error {
    background-color: var(--danger-color);
}

.toast.info {
    background-color: var(--primary-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Footer */
footer {
    margin-top: auto;
    background-color: var(--primary-dark);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tips-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tip-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tip-card.has-cover {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .tip-cover {
        width: 150px;
    }

    .tip-card.has-cover .tip-header {
        justify-content: center;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}
