/**
 * Kohandatud stiilid elektripaigaldiste juhendile
 * Sisaldab märkuste/kommentaaride funktsiooni stiile
 */

/* ==================== MÄRKUSTE STIILID ==================== */

/* Kontekstimenüü (parema hiire klõps) */
.comment-context-menu {
    position: fixed !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
    padding: 5px !important;
    z-index: 10000 !important;
    display: none; /* Ei tohi olla !important, muidu JavaScript ei saa seda muuta */
}

.comment-context-menu.show {
    display: block !important;
}

.comment-menu-btn {
    background: #2E7D32 !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    display: block !important;
}

.comment-menu-btn:hover {
    background: #1B5E20 !important;
}

/* Märkuse lisamise dialoog */
.comment-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s;
}

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

.comment-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s;
}

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

.comment-dialog-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-dialog-header h3 {
    margin: 0;
    color: #2E7D32;
}

.comment-dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-dialog-close:hover {
    color: #000;
    background: #f0f0f0;
    border-radius: 50%;
}

.comment-dialog-body {
    padding: 20px;
    overflow-y: auto;
}

/* Juhendi dialoog */
.comment-help-dialog {
    max-width: 700px;
}

.comment-help-content {
    max-height: 70vh;
}

.comment-help-content h4 {
    color: #2E7D32;
    margin: 20px 0 10px 0;
    font-size: 16px;
    border-bottom: 2px solid #2E7D32;
    padding-bottom: 5px;
}

.comment-help-content h4:first-child {
    margin-top: 0;
}

.comment-help-content ol,
.comment-help-content ul {
    margin: 10px 0;
    padding-left: 25px;
}

.comment-help-content li {
    margin: 8px 0;
    line-height: 1.6;
}

.comment-help-content ul ul {
    margin: 5px 0;
}

.comment-help-content p {
    margin: 10px 0;
    line-height: 1.6;
}

.comment-help-content strong {
    color: #2E7D32;
    font-weight: 600;
}

.comment-selected-text {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 3px solid #2E7D32;
}

.comment-selected-text p {
    margin: 5px 0 0 0;
    font-style: italic;
    color: #555;
    font-size: 15px;
}

/* Input väli (nimi) */
.comment-dialog-body input[type="text"],
.comment-author-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 16px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.comment-dialog-body input[type="text"]:focus,
.comment-author-input:focus {
    outline: none;
    border-color: #2E7D32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.1);
}

/* Textarea (märkuse tekst) */
.comment-dialog-body textarea,
.comment-text-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    box-sizing: border-box;
    min-height: 120px;
}

.comment-dialog-body textarea:focus,
.comment-text-input:focus {
    outline: none;
    border-color: #2E7D32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.1);
}

.comment-dialog-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.comment-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.comment-btn-cancel {
    background: #f5f5f5;
    color: #333;
    font-size: 16px;
    padding: 14px 28px;
}

.comment-btn-cancel:hover {
    background: #e0e0e0;
}

.comment-btn-save {
    background: #2E7D32;
    color: white;
    font-size: 16px;
    padding: 14px 28px;
}

.comment-btn-save:hover {
    background: #1B5E20;
}

.comment-btn-delete {
    background: #d32f2f;
    color: white;
    font-size: 16px;
    padding: 14px 28px;
}

.comment-btn-delete:hover {
    background: #c62828;
}

/* Märgistatud tekst (highlight) */
.comment-highlight {
    background-color: #fff176;
    border-bottom: 2px solid #fbc02d;
    position: relative;
    padding: 2px 0;
    cursor: pointer;
}

.comment-highlight:hover {
    background-color: #ffee58;
}

/* Märkuse ikoon */
.comment-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 16px;
    cursor: pointer;
    vertical-align: super;
    animation: bounceIn 0.5s;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.comment-icon:hover {
    transform: scale(1.2);
}

/* Märkuse popup */
.comment-popup {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 0;
    z-index: 10002;
    max-width: 400px;
    animation: fadeIn 0.2s;
}

.comment-popup-header {
    background: #2E7D32;
    color: white;
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-popup-close:hover {
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
}

.comment-popup-body {
    padding: 15px;
}

.comment-popup-body p {
    margin: 8px 0;
}

.comment-popup-selected {
    font-style: italic;
    color: #666;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.comment-popup-time {
    font-size: 12px;
    color: #999;
    margin-top: 10px !important;
}

.comment-popup-footer {
    border-top: 1px solid #e0e0e0;
    padding: 10px 15px;
}

.comment-btn-small {
    padding: 10px 18px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.comment-btn-small:hover {
    background: #e0e0e0;
}

/* Teade (notification) */
.comment-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2E7D32;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 10003;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.comment-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Toggle nupp */
.comment-toggle-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    background: #2E7D32 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 24px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s !important;
}

.comment-toggle-btn:hover {
    background: #1B5E20 !important;
    transform: scale(1.1) !important;
}

.comment-toggle-btn.disabled {
    background: #999 !important;
}

/* Badge (märkuste arv) */
.comment-badge,
.comment-toggle-btn .comment-badge,
.comment-export-btn .comment-badge,
#comment-toggle-btn .comment-badge,
#comment-export-btn .comment-badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    left: auto !important;
    bottom: auto !important;
    background: #f44336 !important;
    color: white !important;
    border-radius: 50% !important;
    min-width: 20px !important;
    width: auto !important;
    height: 20px !important;
    padding: 2px 6px !important;
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    animation: badgePulse 2s infinite !important;
    z-index: 10000 !important;
    pointer-events: none !important;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Märkuste halduspaneel */
.comment-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-width: 350px;
    max-height: 400px;
    z-index: 9998;
    overflow: hidden;
}

.comment-panel-header {
    background: #2E7D32;
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.comment-panel-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
}

.comment-panel-body {
    padding: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.comment-panel-item {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

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

.comment-panel-item-text {
    font-size: 13px;
    color: #666;
    font-style: italic;
    margin-bottom: 5px;
}

.comment-panel-item-comment {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.comment-panel-item-actions {
    display: flex;
    gap: 5px;
}

/* Tumedale teemale kohandused */
[data-md-color-scheme="slate"] .comment-dialog,
[data-md-color-scheme="slate"] .comment-popup,
[data-md-color-scheme="slate"] .comment-context-menu,
[data-md-color-scheme="slate"] .comment-panel {
    background: #2e2e2e;
    color: #e0e0e0;
    border-color: #444;
}

[data-md-color-scheme="slate"] .comment-selected-text,
[data-md-color-scheme="slate"] .comment-popup-selected {
    background: #1e1e1e;
    color: #ccc;
}

[data-md-color-scheme="slate"] .comment-dialog-header,
[data-md-color-scheme="slate"] .comment-dialog-footer,
[data-md-color-scheme="slate"] .comment-popup-footer {
    border-color: #444;
}

[data-md-color-scheme="slate"] .comment-dialog-body textarea {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #444;
}

[data-md-color-scheme="slate"] .comment-btn-cancel {
    background: #3a3a3a;
    color: #e0e0e0;
}

[data-md-color-scheme="slate"] .comment-btn-cancel:hover {
    background: #4a4a4a;
}

/* Responsiivsus */
@media (max-width: 768px) {
    .comment-dialog {
        max-width: 95%;
        margin: 10px;
    }

    .comment-popup {
        max-width: 90%;
    }

    .comment-panel {
        max-width: 90%;
        right: 5%;
    }

    .comment-toggle-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .comment-export-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* Ekspordi nupp (ülemine) */
.comment-export-btn {
    position: fixed !important;
    top: 80px !important;
    right: 20px !important;
    background: #607D8B !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 24px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s !important;
}

.comment-export-btn:hover {
    background: #455A64 !important;
    transform: scale(1.15) !important;
}

/* INFO nupp (alumine - pulseeriv) */
.comment-info-btn {
    position: fixed !important;
    top: 140px !important; /* 60px alumal ekspordi nupust (80 + 50 + 10) */
    right: 20px !important;
    background: #2E7D32 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 24px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s !important;
    animation: pulse 2s ease-in-out infinite !important;
}

.comment-info-btn:hover {
    background: #1B5E20 !important;
    animation: none !important; /* Peata pulseerimise kui hover */
    transform: scale(1.15) !important;
}

/* Pulseerimise animatsioon (märgatavam) */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 6px 25px rgba(46, 125, 50, 0.6);
        opacity: 0.9;
    }
}

/* Ekspordi menüü */
.comment-export-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10004;
    animation: fadeIn 0.2s;
}

.comment-export-menu-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s;
}

.comment-export-menu-content h3 {
    margin: 0 0 10px 0;
    color: #2E7D32;
}

.comment-export-menu-content h4 {
    margin: 15px 0 10px 0;
    color: #2E7D32;
    font-size: 16px;
}

.comment-export-menu-content p {
    margin: 10px 0;
    color: #666;
}

.comment-export-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

/* Märkuste nimekiri eelvaade */
.comment-list-preview {
    max-height: 400px;
    overflow-y: auto;
    margin: 15px 0;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.comment-page-group {
    margin-bottom: 20px;
}

.comment-page-group:last-child {
    margin-bottom: 0;
}

.comment-page-title {
    font-weight: 600;
    font-size: 14px;
    color: #2E7D32;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #2E7D32;
}

.comment-preview-item {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 3px solid #2E7D32;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.comment-preview-item:last-child {
    margin-bottom: 0;
}

.comment-preview-author {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.comment-preview-text {
    font-size: 13px;
    font-style: italic;
    color: #666;
    background: #f5f5f5;
    padding: 6px 8px;
    border-radius: 3px;
    margin-bottom: 6px;
}

.comment-preview-comment {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    margin-bottom: 10px;
}

.comment-preview-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.comment-action-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-edit-btn:hover {
    background: #2E7D32;
    border-color: #2E7D32;
    transform: scale(1.05);
}

.comment-delete-btn:hover {
    background: #d32f2f;
    border-color: #d32f2f;
    transform: scale(1.05);
}

.comment-btn-export,
.comment-btn-import {
    padding: 16px 24px;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s;
}

.comment-btn-export:hover {
    background: #1B5E20;
}

.comment-btn-import {
    background: #607D8B;
}

.comment-btn-import:hover {
    background: #455A64;
}

.comment-btn-email {
    padding: 16px 24px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s;
}

.comment-btn-email:hover {
    background: #F57C00;
}

.comment-export-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.comment-export-info ol {
    margin: 10px 0;
    padding-left: 20px;
}

.comment-export-info li {
    margin: 5px 0;
    color: #333;
}

.comment-export-info code {
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.comment-panel-item-author {
    font-size: 12px;
    color: #2E7D32;
    font-weight: 600;
    margin-bottom: 3px;
}

/* Tumedale teemale kohandused ekspordi menüü jaoks */
[data-md-color-scheme="slate"] .comment-export-menu-content {
    background: #2e2e2e;
    color: #e0e0e0;
}

[data-md-color-scheme="slate"] .comment-export-menu-content h3,
[data-md-color-scheme="slate"] .comment-export-menu-content h4 {
    color: #81C784;
}

[data-md-color-scheme="slate"] .comment-export-info {
    background: #1e1e1e;
}

[data-md-color-scheme="slate"] .comment-export-info code {
    background: #3a3a3a;
    color: #e0e0e0;
}

/* Dark mode märkuste nimekiri */
[data-md-color-scheme="slate"] .comment-list-preview {
    background: #1e1e1e;
    border-color: #444;
}

[data-md-color-scheme="slate"] .comment-page-title {
    color: #81C784;
    border-bottom-color: #81C784;
}

[data-md-color-scheme="slate"] .comment-preview-item {
    background: #2e2e2e;
    border-left-color: #81C784;
}

[data-md-color-scheme="slate"] .comment-preview-author,
[data-md-color-scheme="slate"] .comment-preview-comment {
    color: #e0e0e0;
}

[data-md-color-scheme="slate"] .comment-preview-text {
    background: #1e1e1e;
    color: #ccc;
}

[data-md-color-scheme="slate"] .comment-info-btn {
    background: #81C784;
    color: #1e1e1e;
}

[data-md-color-scheme="slate"] .comment-info-btn:hover {
    background: #66BB6A;
}

[data-md-color-scheme="slate"] .comment-help-content h4 {
    color: #81C784;
    border-bottom-color: #81C784;
}

[data-md-color-scheme="slate"] .comment-help-content strong {
    color: #81C784;
}

[data-md-color-scheme="slate"] .comment-preview-actions {
    border-top-color: #444;
}

[data-md-color-scheme="slate"] .comment-action-btn {
    background: #2e2e2e;
    border-color: #444;
}

[data-md-color-scheme="slate"] .comment-edit-btn:hover {
    background: #81C784;
    border-color: #81C784;
}

[data-md-color-scheme="slate"] .comment-delete-btn:hover {
    background: #e57373;
    border-color: #e57373;
}
