/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Mono', monospace;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 24px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: #4285f4;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 16px;
}

.logo-text {
    font-size: 18px;
    font-weight: 500;
    color: #333333;
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-title {
    font-size: 12px;
    font-weight: 500;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.collections-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.collection-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #666666;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.collection-item-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.collection-icon {
    flex-shrink: 0;
    color: #666666;
}

.collection-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-item:hover {
    background-color: #e9ecef;
    color: #333333;
}

.collection-item:hover .collection-icon {
    color: #333333;
}

.collection-item.active {
    background-color: #D4D2FD;
    color: #333333;
    font-weight: 500;
}

.collection-item.active .collection-icon {
    color: #333333;
}

.collection-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666666;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.collection-item:hover .collection-delete-btn {
    opacity: 0.6;
}

.collection-item:hover .collection-delete-btn:hover {
    opacity: 1;
    color: #dc3545;
}

.nav-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-collection-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.add-collection-btn:hover {
    background-color: #e9ecef;
    color: #333333;
}

.view-snippets-item {
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #D4D2FD;
    margin-bottom: 8px;
}

.view-snippets-item:hover {
    background-color: #C4C2ED;
}

.view-snippets-item.active {
    background-color: #D4D2FD;
}

.view-snippets-item .nav-title {
    color: #333333;
    font-weight: 500;
    margin: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-email {
    font-size: 12px;
    color: #666666;
}

.logout-btn {
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #666666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: #e9ecef;
    color: #333333;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    min-height: 100vh;
}

/* Content Header */
.content-header {
    margin-bottom: 32px;
}

.header-info {
    margin-bottom: 16px;
}

.header-subtitle {
    font-size: 12px;
    color: #666666;
    margin-bottom: 4px;
}

.collection-title {
    font-size: 24px;
    font-weight: 500;
    color: #333333;
    margin-bottom: 8px;
}

.collection-description-main {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
    margin-top: 8px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #666666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: #e9ecef;
    color: #333333;
}

.add-to-collection-area {
    margin-top: 24px;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4285f4;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

.clear-selection-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #4285f4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    opacity: 0.8;
}

.clear-selection-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.collection-select {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    background-color: white;
    color: #333333;
    min-width: 220px;
    flex: 1;
}

.collection-select:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.add-to-new-collection-btn {
    padding: 8px 16px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
}

.add-to-new-collection-btn:hover {
    background-color: #f0f0f0;
}

.selection-hint {
    margin-top: 24px;
    padding: 16px;
    text-align: center;
    color: #999999;
    font-size: 14px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Snippets Grid */
.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.snippet-card {
    background-color: #D4D2FD;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.snippet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.snippet-card.expanded {
    /* Cards expand vertically only, not horizontally */
}

.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.snippet-title {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    margin-bottom: 8px;
    flex: 1;
}

.snippet-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666666;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.snippet-delete-btn:hover {
    opacity: 1;
    color: #dc3545;
}

.snippet-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333333;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.snippet-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.snippet-note-section {
    margin-top: 12px;
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.snippet-note-label {
    font-size: 12px;
    color: #333333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.note-icon {
    font-size: 14px;
}

.snippet-note-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.snippet-note-text {
    font-size: 13px;
    color: #333333;
    flex: 1;
    line-height: 1.5;
}

.snippet-note-edit-btn {
    background: none;
    border: 1px solid #e9ecef;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    color: #666666;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'IBM Plex Mono', monospace;
}

.snippet-note-edit-btn:hover {
    background-color: #f8f9fa;
    color: #333333;
}

.snippet-note-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.snippet-note-add {
    margin-top: 12px;
}

.snippet-note-add-btn {
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #666666;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'IBM Plex Mono', monospace;
}

.snippet-note-add-btn:hover {
    background-color: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.2);
}

.snippet-note-add-btn span {
    font-size: 16px;
    font-weight: 600;
}

.snippet-note-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 0;
    background-color: white;
    color: #333333;
}

.snippet-note-input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.snippet-note-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
    width: 100%;
}

.snippet-note-save-btn,
.snippet-note-cancel-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'IBM Plex Mono', monospace;
}

.snippet-note-save-btn {
    background-color: #4285f4;
    color: white;
    border: none;
    font-weight: 500;
}

.snippet-note-save-btn:hover {
    background-color: #3367d6;
}

.snippet-note-cancel-btn {
    background-color: white;
    border: 1px solid #e9ecef;
    color: #666666;
}

.snippet-note-cancel-btn:hover {
    background-color: #f8f9fa;
    color: #333333;
}

.snippet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.snippet-source {
    display: inline-block;
    padding: 4px 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    font-size: 11px;
    color: #666666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.snippet-source:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: #333333;
}

.snippet-timestamp {
    font-size: 11px;
    color: #999999;
}

.snippet-card.selected {
    border: 2px solid #4285f4;
    background-color: #E8E6FF;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 14px;
    color: #666666;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: #666666;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333333;
}

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

.empty-state .action-btn {
    background-color: #4285f4;
    color: white;
    border: none;
}

.empty-state .action-btn:hover {
    background-color: #3367d6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .snippets-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Authentication Styles */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f8f9fa;
}

.auth-card {
    background: white;
    padding: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.auth-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #333333;
}

.auth-card p {
    color: #666666;
    margin-bottom: 32px;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.auth-btn:hover {
    background-color: #3367d6;
    transform: translateY(-1px);
}

.auth-btn svg {
    width: 18px;
    height: 18px;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: #333333;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

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

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #333333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: #333333;
    background-color: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

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

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.modal-cancel-btn {
    padding: 10px 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #666666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-cancel-btn:hover {
    background-color: #e9ecef;
    color: #333333;
}

.modal-submit-btn {
    padding: 10px 20px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-submit-btn:hover {
    background-color: #3367d6;
}

.modal-submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
