/* Advanced Note Taker - Modern CSS */
:root {
    --primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-dark: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --warning: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --dark: #1a202c;
    --light: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.tool-page {
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
}

.tool-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Enhanced Header Section */
.header-section {
    background: var(--primary);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="25" cy="25" r="2" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="1.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="2" fill="%23ffffff" opacity="0.1"/></svg>') repeat;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-1%, -1%) rotate(90deg); }
    50% { transform: translate(1%, -2%) rotate(180deg); }
    75% { transform: translate(-2%, 1%) rotate(270deg); }
}

.header-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.header-section h1 i {
    margin-right: 0.75rem;
    color: #f093fb;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.tool-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.feature-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.badge i {
    font-size: 1rem;
}

/* Tool Interface */
.tool-interface {
    padding: 2rem;
}

.notes-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    min-height: 700px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Enhanced Sidebar */
.notes-sidebar {
    background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    margin-bottom: 1.5rem;
}

.search-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

#search-notes {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    font-size: 0.9rem;
    transition: var(--transition);
}

#search-notes:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.dropdown-content {
    display: none;
    position: absolute;
    background: white;
    min-width: 150px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    z-index: 1000;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
}

.dropdown-content.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid #f1f5f9;
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background: #f8fafc;
    color: #667eea;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: var(--radius);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Notes List */
.notes-list {
    flex: 1;
    overflow-y: auto;
    margin: -0.5rem;
    padding: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.note-item {
    background: white;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.note-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: var(--transition);
    transform-origin: top;
}

.note-item:hover::before {
    transform: scaleY(1);
}

.note-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #667eea;
}

.note-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.05));
    border-color: #667eea;
    box-shadow: var(--shadow);
}

.note-item.active::before {
    transform: scaleY(1);
}

.note-item h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.note-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.note-category {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Editor */
.note-editor {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.title-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

#note-title {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    transition: var(--transition);
}

#note-title:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.category-select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.category-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.format-tools {
    display: flex;
    gap: 0.5rem;
}

.format-btn {
    background: white;
    border: 2px solid var(--border);
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.format-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.action-tools {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.tool-btn {
    background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.tool-btn:hover {
    background: var(--primary);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.9rem;
}

.action-btn.primary {
    background: var(--primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.action-btn.secondary {
    background: var(--secondary);
    color: white;
}

.action-btn.secondary:hover {
    background: linear-gradient(135deg, #e879f9 0%, #f43f5e 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
}

.action-btn.danger {
    background: var(--danger);
    color: white;
}

.action-btn.danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Editor Content */
.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

#note-content {
    flex: 1;
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.7;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    resize: none;
    background: #fafbfc;
    transition: var(--transition);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#note-content:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.save-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success);
    font-size: 0.85rem;
}

.save-status i {
    color: #22c55e;
}

.note-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Comprehensive Responsive Design */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .notes-container {
        grid-template-columns: 400px 1fr;
    }
    
    .header-section h1 {
        font-size: 3rem;
    }
}

/* Medium screens (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .notes-container {
        grid-template-columns: 320px 1fr;
    }
    
    .header-section {
        padding: 2.5rem 2rem;
    }
    
    .header-section h1 {
        font-size: 2.2rem;
    }
}

/* Tablet screens (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .tool-page {
        padding: 1.5rem 1rem;
    }
    
    .notes-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .notes-sidebar {
        order: 1;
        max-height: 400px;
        overflow-y: auto;
    }
    
    .note-editor {
        order: 2;
        min-height: 500px;
    }
    
    .header-section {
        padding: 2rem 1.5rem;
    }
    
    .header-section h1 {
        font-size: 2rem;
    }
    
    .feature-badges {
        gap: 0.5rem;
    }
    
    .badge {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .editor-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .format-tools {
        justify-content: center;
    }
    
    .action-tools {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Mobile screens (575px and below) */
@media (max-width: 767px) {
    .tool-page {
        padding: 1rem 0.5rem;
    }
    
    .tool-interface {
        padding: 1rem;
    }
    
    .notes-container {
        gap: 1rem;
    }
    
    .notes-sidebar {
        padding: 1rem;
        max-height: 350px;
    }
    
    .sidebar-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dropdown-btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .header-section {
        padding: 1.5rem 1rem;
    }
    
    .header-section h1 {
        font-size: 1.8rem;
    }
    
    .header-section h1 i {
        display: block;
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .tool-description {
        font-size: 1rem;
    }
    
    .feature-badges {
        gap: 0.5rem;
    }
    
    .badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        flex: 1;
        justify-content: center;
    }
    
    .title-section {
        flex-direction: column;
    }
    
    .editor-header {
        padding: 1rem;
    }
    
    .editor-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-tools {
        flex-wrap: wrap;
    }
    
    .action-btn {
        justify-content: center;
        padding: 0.75rem;
    }
    
    .editor-content {
        padding: 1rem;
    }
    
    #note-content {
        padding: 1rem;
        min-height: 300px;
    }
    
    .editor-footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Extra small devices (400px and below) */
@media (max-width: 400px) {
    .header-section h1 {
        font-size: 1.5rem;
    }
    
    .tool-description {
        font-size: 0.9rem;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .notes-sidebar {
        max-height: 300px;
    }
    
    .action-btn {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
    
    .format-btn,
    .tool-btn {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    #note-content {
        min-height: 250px;
        font-size: 0.9rem;
    }
}

/* Custom Scrollbar for Notes List */
.notes-list::-webkit-scrollbar {
    width: 6px;
}

.notes-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.notes-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.notes-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Animation for new notes */
.note-item.new {
    animation: slideInLeft 0.5s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
