/* frontend/public/styles.css */

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

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

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

h1 {
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1em;
}

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

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

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-secondary {
    background: #999;
    color: white;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 20px;
}

.add-button-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.search-bar {
    display: flex;
    gap: 10px;
    position: relative;
}

.search-bar input {
    flex: 1;
    padding: 15px 50px 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-bar input:focus {
    outline: 2px solid white;
}

.btn-clear {
    position: absolute;
    right: 110px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.8em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
}

.btn-clear:hover {
    background: #f0f0f0;
    color: #333;
}

.search-info {
    text-align: center;
    color: white;
    margin-top: 10px;
    font-size: 0.9em;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 0;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 4px;
}

.tab-button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: white;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.back-button {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s;
}

.back-button:hover {
    transform: translateY(-2px);
}

#loading {
    text-align: center;
    color: white;
    font-size: 1.2em;
    padding: 40px;
}

#error {
    background: #ff4444;
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin: 20px 0;
}

.success-message {
    background: #4caf50;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

.pagination button {
    padding: 10px 20px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    color: white;
    font-weight: bold;
}

/* List View Styles */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.no-results-message {
    grid-column: 1 / -1;
    text-align: center;
    color: white;
    padding: 40px;
    font-size: 1.2em;
}

.exercise-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.exercise-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.2);
}

/* Star Button */
.star-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    color: #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.star-button:hover {
    transform: scale(1.1);
    background: white;
}

.star-button.favorited {
    color: #ffd700;
}

.card-content {
    cursor: pointer;
}

.exercise-image-container {
    width: 100%;
    height: 180px;
    position: relative;
    background: #f0f0f0;
    overflow: hidden;
}

.exercise-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3em;
}

.exercise-card-title {
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    text-align: center;
}

/* Detail View Styles */
.detail-view {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
}

.detail-view.active {
    display: block;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.detail-title {
    font-size: 2em;
    color: #333;
    flex: 1;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.detail-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.detail-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    color: #667eea;
    font-size: 1.3em;
    margin-bottom: 10px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.info-label {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.info-value {
    color: #333;
}

.tag {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    margin: 4px 4px 4px 0;
}

.difficulty {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
}

.difficulty.beginner { background: #4caf50; color: white; }
.difficulty.intermediate { background: #ff9800; color: white; }
.difficulty.expert { background: #f44336; color: white; }

.instructions-text {
    line-height: 1.8;
    color: #555;
}

.list-view {
    display: block;
}

.list-view.hidden {
    display: none;
}

/* Edit Form Styles */
.edit-form {
    display: none;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.edit-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

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

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #667eea;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}